/*

There are 2 categories of variables:

- Variables that start with SQ are cleaned variables easily to link to the
questionaire. These variables are ready for analysis.

- Variables that start with SP are auxiliar variables and not to be used for
analysis.

*/


use "$Baseline_dtRaw/surveys/150910_CEIS_BD_Escolas_Final.dta", clear

set more off

********************************************************************************
************************************ INTRO *************************************
********************************************************************************
{
rename P1_Rec school_id
rename P2 school_name
rename P12 bairro_name
rename ComunaDescricao commune_name

gen vil_id = 1 if inlist(school_id,1,	2,	3,	4,	5,	6,	7,	8,	9,	10,	12,	13,	14,	15,	16,	17,	18,	19,	20,	21,	22,	24,	25,	26,	27,	28,	29,	30,	31,	32,	33,	34,	35,	37,	40,	45,	61,	86,	110)
replace vil_id = 2 if inlist(school_id,23,	43,	44,	46,	47,	48,	49,	50,	51,	52,	53,	54,	55,	56,	57,	58,	59,	60,	62,	63,	64,	65,	66,	67,	68,	69,	70,	71,	72,	73,	75,	76,	77,	78,	79,	80,	81)
replace vil_id = 3 if inlist(school_id,11,	36,	38,	39,	41,	42,	74,	82,	83,	84,	85,	87,	88,	89,	90,	91,	92,	93,	94,	95,	96,	97,	98,	99,	101,	102,	103,	104,	105)
replace vil_id = 4 if inlist(school_id,118,	119,	120,	121,	122,	123,	124,	125)
replace vil_id = 5 if inlist(school_id,100,	112,	113,	114,	115,	116,	117)
replace vil_id = 6 if inlist(school_id,109,	111)
replace vil_id = 7 if inlist(school_id,106,	107)
replace vil_id = 8 if inlist(school_id,126)
replace vil_id = 9 if inlist(school_id,108)

lab def vil 1 "Sumbe" 2 "Porto Amboim" 3	"Gabela" 4	"Conda" 5	"Ebo" 6	"Quilenda" 7	"Seles" 8	"Cassongue" 9	"Quibala"
lab val vil_id vil

rename P3 school_tel
rename Respondent_ID resp_id
rename P4 resp_name
rename P5 resp_position
rename P6 resp_tel

lab def resp_position 1	"Director" 2	"Deputy Director" 3	"Acting Director"
lab val resp_position resp_position

order school_id school_name vil_id commune_name bairro_name school_tel resp_id resp_name resp_position resp_tel

drop ProvinciaDescricao MunicipioDescricao P1 P2_Rec P3_Codes P6_Codes

rename Q1 resp_total

replace Q2_0_Z1 = 8 if Q2_0_Z1_C7=="Coordenador do bairro"
replace Q2_0_Z1 = 1 if Q2_0_Z1_C7=="Director interino"
replace Q2_0_Z1 = 2 if Q2_0_Z1_C7=="Subdirector em exercicio"
replace Q2_2_Z1 = 9 if Q2_2_Z1_C7=="Coordenador da comissão de pais"

egen resp_directores = anycount(Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1), values(1)
egen resp_vice = anycount(Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1), values(2)
egen resp_profdisp = anycount(Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1), values(3)
egen resp_profturma = anycount(Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1), values(4)
egen resp_profother = anycount(Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1), values(5)
egen resp_respdiredu = anycount(Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1), values(6)
egen resp_secretary = anycount(Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1), values(7)
egen resp_chefbairro = anycount(Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1), values(8)
egen resp_commpais = anycount(Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1), values(9)

drop Q2_0_Z1 Q2_1_Z1 Q2_2_Z1 Q2_3_Z1 Q2_4_Z1 Q2_5_Z1 Q2_6_Z1 Q2_7_Z1 Q2_8_Z1 Q2_9_Z1 Q2_10_Z1 Q2_11_Z1 Q2_12_Z1 Q2_13_Z1 Q2_14_Z1 Q2_15_Z1 Q2_16_Z1 Q2_17_Z1 Q2_18_Z1 Q2_19_Z1 Q2_20_Z1 Q2_21_Z1 Q2_22_Z1 Q2_23_Z1 Q2_24_Z1 Q2_25_Z1 Q2_26_Z1 Q2_27_Z1 Q2_28_Z1 Q2_29_Z1 Q2_30_Z1 Q2_0_Z1_C7 Q2_1_Z1_C7 Q2_2_Z1_C7 Q2_3_Z1_C7 Q2_4_Z1_C7 Q2_5_Z1_C7 Q2_6_Z1_C7 Q2_7_Z1_C7 Q2_8_Z1_C7 Q2_9_Z1_C7 Q2_10_Z1_C7 Q2_11_Z1_C7 Q2_12_Z1_C7 Q2_13_Z1_C7 Q2_14_Z1_C7 Q2_15_Z1_C7 Q2_16_Z1_C7 Q2_17_Z1_C7 Q2_18_Z1_C7 Q2_19_Z1_C7 Q2_20_Z1_C7 Q2_21_Z1_C7 Q2_22_Z1_C7 Q2_23_Z1_C7 Q2_24_Z1_C7 Q2_25_Z1_C7 Q2_26_Z1_C7 Q2_27_Z1_C7 Q2_28_Z1_C7 Q2_29_Z1_C7 Q2_30_Z1_C7

rename Q3 typecomm
lab def typecomm 1	"A neighbourhood" 2	"A commune" 3	"A municipality/village"
lab val typecomm typecomm

order school_id school_name vil_id commune_name bairro_name school_tel resp_id resp_name resp_position resp_tel resp_total resp_directores resp_vice resp_profdisp resp_profturma resp_profother resp_respdiredu resp_secretary resp_chefbairro resp_commpais typecomm

lab var school_id 			"ID number school"
lab var school_name 		"Name school"
lab var vil_id 				"ID number village, value label includes names"
lab var commune_name 		"Name commune"
lab var bairro_name 		"Name bairro"
lab var school_tel 			"Phone number school"
lab var resp_id 			"ID number respondent"
lab var resp_name 			"Name main respondent"
lab var resp_position 			"Position of main respondent at the school"
lab var resp_tel 			"Phone number main respondent"
lab var resp_total 			"Number of respondents"
lab var resp_directores 	"Number of respondents that are director"
lab var resp_vice 			"Number of respondents that are vice director"
lab var resp_profdisp 		"Number of respondents that are teacher (course coordinator)"
lab var resp_profturma 		"Number of respondents that are teacher (class coordinator)"
lab var resp_profother 		"Number of respondents that are teacher (other)"
lab var resp_respdiredu 	"Number of respondents that are responsible for the town directorate of education)"
lab var resp_secretary 		"Number of respondents that are school secretary"
lab var resp_chefbairro 	"Number of respondents that are head of the neighbourhood"
lab var resp_commpais 		"Number of respondents that are parents in the community"
lab var typecomm			"Type of community"
}
********************************************************************************
********************************** SECTION 1 ***********************************
********************************************************************************
{
lab def dummy 1 "Yes" 0 "No"

rename S1_1 Q1_01

lab var Q1_01 		"When did the school start working?"

rename S1_2 Q1_02
replace Q1_02 = 2 if S1_2_C4=="Comunidade"
replace Q1_02 = 3 if S1_2_C4=="Irgeja Reformada em Angola"
replace Q1_02 = 3 if S1_2_C4=="IERA"
replace Q1_02 = 4 if S1_2_C4=="FAS, FESA, Administração"
replace Q1_02 = 4 if S1_2_C4=="FAS"
replace Q1_02 = 5 if S1_2_C4=="ONG"
replace Q1_02 = 6 if S1_2_C4=="Empresa privada"

lab def Q1_02 1 "State" 2 "Community-based organization" 3 "Religious group" 4 "FAS" 5 "NGO" 6 "Private company"
lab val Q1_02 Q1_02

lab var Q1_02 		"Founding institution/organization of the school"
lab var S1_2_C4 	"AUX"

*NOTE "Q1_02"
*FAS is the state, maybe change this

rename S1_3_C(#)_Q1 Q1_03_0(#)

replace Q1_03_01 = 0 if Q1_03_06==100

lab var Q1_03_01		"State's relative contribution to school budget (percentage)"
lab var Q1_03_02		"Parents' relative contribution to school budget (percentage)"
lab var Q1_03_03		"Local government's (province or municipality) relative contribution to school budget (percentage)"
lab var Q1_03_04		"NGO's relative contribution to school budget (percentage)"
lab var Q1_03_05		"Civil group's relative contribution to school budget (percentage)"
lab var Q1_03_06		"Other organization's relative contribution to school budget (percentage)"

*NOTE Q1_03_06*
*No definition for others; could be FAS in there, which can be considered state*

rename S1_4 Q1_04
replace Q1_04 = . if Q1_04==3
replace Q1_04 = 1 if inlist(S1_4_C3,"2","4","7")
replace Q1_04 = 3 if S1_4_C3=="mais 12"
lab def Q1_04 1 "Primary school with less than 9 years of schooling, dependent on another school" 2 "School with 9 years of schooling" 3 "School with more than 9 years of schooling"
lab val Q1_04 Q1_04

lab var S1_4_C3 			"AUX"
lab var Q1_04 				"Years of education provided by school"

rename S1_5_C1 Q1_05_name
rename S1_5_C2 Q1_05_vil
rename S1_5_C3 Q1_05_com

replace Q1_05_name="" if inlist(Q1_05_name,"Não depende","nao depende","nao depende de outra","não depende")
replace Q1_05_vil="" if inlist(Q1_05_name,"Não depende","nao depende","nao depende de outra","não depende")
replace Q1_05_com="" if inlist(Q1_05_name,"Não depende","nao depende","nao depende de outra","não depende")

lab var Q1_05_name "Name of school this school depends on"
lab var Q1_05_vil "Village of school this school depends on"
lab var Q1_05_com "Commune of school this school depends on"

lab var S1_51 "AUX"
lab var S1_52 "AUX"
lab var S1_53 "AUX"
lab var S1_54 "AUX"

*NOTE S1_4 S1_5 Q1_54*
*Not to happy about these variables, probelems in questioning*

lab var S1_6 "Does the school have classes with more than one year of schooling?"
lab var S1_7 "Are the 3rd class students part of a class with more than one year of schooling?"
lab var S1_8 "Distance, in km, to the nearest municipal center?"
lab var S1_9 "Number of schools within a 5-kilometer radius"
lab var S1_10 "Does this school have nearby pubic transports?"
lab var S1_11_C1_Q1_C1_Z1 "1st trimester 2013, Beginning: Day"
lab var S1_11_C1_Q1_C2_Z1 "1st trimester 2013, End: Day"

lab var S1_11_C2_Q1_C1_Z1 "2nd trimester 2013, Beginning: Day"
lab var S1_11_C2_Q1_C2_Z1 "2nd trimester 2013, End: Day"

lab var S1_11_C3_Q1_C1_Z1 "3rd trimester 2013, Beginning: Day"
lab var S1_11_C3_Q1_C2_Z1 "3rd trimester 2013, End: Day"

lab var S1_11_C4_Q1_C1_Z1 "1st trimester 2014, Beginning: Day"
lab var S1_11_C4_Q1_C2_Z1 "1st trimester 2014, End: Day"

lab var S1_11_C1_Q1_C1_Z2 "1st trimester 2013, Start: Month"
lab var S1_11_C1_Q1_C2_Z2 "1st trimester 2013, End of month"

lab var S1_11_C2_Q1_C1_Z2 "2nd trimester 2013, Start: Month"
lab var S1_11_C2_Q1_C2_Z2 "2nd trimester 2013, End of month"

lab var S1_11_C3_Q1_C1_Z2 "3rd trimester 2013, Start: Month"
lab var S1_11_C3_Q1_C2_Z2 "3rd trimester 2013, End of month"

lab var S1_11_C4_Q1_C1_Z2 "1st trimester 2014, Start: Month"
lab var S1_11_C4_Q1_C2_Z2 "1st trimester 2014, End: Month"

lab var S1_12 "Normally, the school year has how many weeks of class?"
lab var S1_13 "How many hours of class do students have per day?"

rename S1_6 Q1_06
rename S1_7 Q1_07
rename S1_10 Q1_10

foreach var in Q1_06 Q1_07 Q1_10 {
replace `var' = 0 if `var'==2
}

lab val Q1_06 Q1_07 Q1_10 dummy

rename S1_8 Q1_08

replace Q1_08=. if Q1_08>150

rename S1_9 Q1_09
rename S1_12 Q1_12
rename S1_13 Q1_13

*NOTE S1_11*
*Untreated, look for objective*

rename S1_11_C(#)_Q1_C1_Z1 Q1_11_0(#)_startday
rename S1_11_C(#)_Q1_C2_Z1 Q1_11_0(#)_endday

rename S1_11_C(#)_Q1_C1_Z2 Q1_11_0(#)_startmonth
rename S1_11_C(#)_Q1_C2_Z2 Q1_11_0(#)_endmonth

order S1_2_C4 S1_4_C3 S1_51 S1_52 S1_53 S1_54, after(Q1_13)
}
********************************************************************************
********************************** SECTION 2 ***********************************
********************************************************************************
{
lab var S2_1_4_C1_Qa "Permanent classrooms (made of brick / cement): Total number."
lab var S2_1_4_C2_Qa "Teacher / staff quarters: Total number."
lab var S2_1_4_C3_Qa "Student dormitories: Total number."
lab var S2_1_4_C4_Qa "Library: Total number."
lab var S2_1_4_C5_Qa "Bathrooms for teachers and staff: Total number."
lab var S2_1_4_C6_Qa "Bathrooms for girls: Total number."
lab var S2_1_4_C7_Qa "Bathrooms for boys: Total number."

lab var S2_1_4_C1_Qb "Permanent classrooms (made of brick / cement): How many of these can not be used today due to poor condition?"
lab var S2_1_4_C2_Qb "Teacher / staff rooms: How many of these can not be used today due to poor condition?"
lab var S2_1_4_C3_Qb "Student dormitories: How many of these can not be used today due to poor condition?"
lab var S2_1_4_C4_Qb "Library: How many of these can not be used today due to poor condition?"
lab var S2_1_4_C5_Qb "Bathrooms for teachers and staff: How many of these can not be used today due to poor condition?"
lab var S2_1_4_C6_Qb "Bathrooms for girls: How many of these can not be used today due to poor condition?"
lab var S2_1_4_C7_Qb "Bathrooms for boys: How many of these can not be used today due to poor condition?"

lab var S2_1_4_C1_Qc "Permanent classrooms (made of brick / cement): How many can not be used at certain times of the year, such as during the rainy season?"
lab var S2_1_4_C2_Qc "Teachers / staff rooms: How many can not be used at certain times of the year, such as during the rainy season?"
lab var S2_1_4_C3_Qc "Student dormitories: How many can not be used at certain times of the year, such as during the rainy season?"
lab var S2_1_4_C4_Qc "Library: How many can not be used at certain times of the year, such as during the rainy season?"
lab var S2_1_4_C5_Qc "Bathrooms for teachers and staff: How many can not be used at certain times of the year, such as during the rainy season?"
lab var S2_1_4_C6_Qc "Bathrooms for girls: How many can not be used at certain times of the year, such as during the rainy season?"
lab var S2_1_4_C7_Qc "Bathrooms for boys: How many can not be used at certain times of the year, such as during the rainy season?"

lab var S2_8 "How many days per month, on average, does the school have no electricity?"
lab var S2_9 "How many days per month, on average, does the school lack water?"
lab var S2_10 "How many computers are available only to teachers and staff?"
lab var S2_11 "How many computers are available to students?"
lab var S2_12 "How many computers have access to the internet?"
lab var S2_13 "Does the school have a telephone?"
lab var S2_14 "Has the school started any construction or reconstruction project in the last three years?"
lab var S2_14_1 "How many projects?"

forval n=1/7{
gen S2_B`n' =  S2_1_4_C`n'_Qa - S2_1_4_C`n'_Qb
}

forval n=1/7{
gen S2_C`n' = S2_1_4_C`n'_Qa - S2_1_4_C`n'_Qc
}

forval n=1/7{
replace S2_1_4_C`n'_Qa = . if S2_B`n'<0
replace S2_1_4_C`n'_Qa = . if S2_C`n'<0
replace S2_1_4_C`n'_Qb = . if S2_B`n'<0
replace S2_1_4_C`n'_Qc = . if S2_C`n'<0
}

rename S2_1_4_C(#)_Qa Q2_0(#)_a
rename S2_1_4_C(#)_Qb Q2_0(#)_b
rename S2_1_4_C(#)_Qc Q2_0(#)_c

order S2_B1 S2_B2 S2_B3 S2_B4 S2_B5 S2_B6 S2_B7 S2_C1 S2_C2 S2_C3 S2_C4 S2_C5 S2_C6 S2_C7, after(Q2_07_c)

lab var S2_B1 "AUX section 2 questions 1-7"
lab var S2_B2 "AUX section 2 questions 1-7"
lab var S2_B3 "AUX section 2 questions 1-7"
lab var S2_B4 "AUX section 2 questions 1-7"
lab var S2_B5 "AUX section 2 questions 1-7"
lab var S2_B6 "AUX section 2 questions 1-7"
lab var S2_B7 "AUX section 2 questions 1-7"

lab var S2_C1 "AUX section 2 questions 1-7"
lab var S2_C2 "AUX section 2 questions 1-7"
lab var S2_C3 "AUX section 2 questions 1-7"
lab var S2_C4 "AUX section 2 questions 1-7"
lab var S2_C5 "AUX section 2 questions 1-7"
lab var S2_C6 "AUX section 2 questions 1-7"
lab var S2_C7 "AUX section 2 questions 1-7"

replace S2_8 = 31 if inlist(S2_8,30,365)
rename S2_8 Q2_08
gen Q2_08_dummy = 0 if Q2_08==31
replace Q2_08_dummy = 1 if Q2_08_dummy==.

lab val Q2_08_dummy dummy
lab var Q2_08_dummy "School has access to electicity"
order Q2_08_dummy, after(Q2_08)

replace S2_9 = 31 if inlist(S2_9,30,365)
rename S2_9 Q2_09

gen Q2_09_dummy = 0 if Q2_09==31
replace Q2_09_dummy = 1 if Q2_09_dummy==.
lab val Q2_09_dummy dummy
lab var Q2_09_dummy "School has access to water"
order Q2_09_dummy, after(Q2_09)

rename S2_10 Q2_10
gen Q2_10_dummy = 0 if Q2_10
replace Q2_10_dummy = 1 if Q2_10_dummy==.
lab val Q2_10_dummy dummy
lab var Q2_10_dummy "Professors have access to computer"
order Q2_10_dummy, after(Q2_10)

rename S2_11 Q2_11
gen Q2_11_dummy = 0 if Q2_11
replace Q2_11_dummy = 1 if Q2_11_dummy==.
lab val Q2_11_dummy dummy
lab var Q2_11_dummy "Students have access to computer"
order Q2_11_dummy, after(Q2_11)

rename S2_12 Q2_12

rename S2_13 Q2_13
replace Q2_13 = 0 if Q2_13==2
lab val Q2_13 dummy
lab var Q2_13 "School has phone"

rename S2_14 Q2_14
replace Q2_14 = 0 if Q2_14==2

rename S2_14_1 Q2_14_num
replace Q2_14_num = . if Q2_14_num==0

foreach var in S2_15_21_0_S2_15 S2_15_21_1_S2_15 S2_15_21_2_S2_15 S2_15_21_3_S2_15 S2_15_21_4_S2_15 S2_15_21_5_S2_15{
replace `var' = . if `var'==6
}

forval n=3/10{
drop S2_15_21_`n'_S2_15
drop S2_15_21_`n'_S2_15_C5
drop S2_15_21_`n'_S2_16
drop S2_15_21_`n'_S2_16_C8
drop S2_15_21_`n'_S2_17
drop S2_15_21_`n'_S2_18
drop S2_15_21_`n'_S2_19
drop S2_15_21_`n'_S2_20
drop S2_15_21_`n'_S2_21
drop S2_15_21_`n'_S2_21_C5
}

foreach var in S2_15_21_0_S2_15 S2_15_21_1_S2_15 S2_15_21_2_S2_15 {
replace `var' = . if `var'==5
lab var `var' "What is being constructed?"
}

replace S2_15_21_0_S2_15 = 5 if S2_15_21_0_S2_15_C5=="Construção de escola nova"
replace S2_15_21_0_S2_15 = 5 if S2_15_21_0_S2_15_C5=="Construção de uma escola nova"
replace S2_15_21_0_S2_15 = 5 if S2_15_21_0_S2_15_C5=="Construção de uma escola nova de raiz"
replace S2_15_21_0_S2_15 = 5 if S2_15_21_0_S2_15_C5=="a propria escola"
replace S2_15_21_0_S2_15 = 5 if S2_15_21_0_S2_15_C5=="reabilita total"
replace S2_15_21_0_S2_15 = 2 if S2_15_21_0_S2_15_C5=="vedação 3 salas"
replace S2_15_21_0_S2_15 = 6 if S2_15_21_0_S2_15_C5=="conts da arrecadalao"
replace S2_15_21_0_S2_15 = 6 if S2_15_21_0_S2_15_C5=="Construção de 1 arrecadação"
replace S2_15_21_0_S2_15 = 6 if S2_15_21_0_S2_15_C5=="Cantina"
replace S2_15_21_0_S2_15 = 6 if S2_15_21_0_S2_15_C5=="Canalização para bebedouros"


foreach var in S2_15_21_0_S2_16 S2_15_21_1_S2_16 S2_15_21_2_S2_16{
replace `var'= . if inlist(`var',8,9)
lab var `var' "What was the main source of funding for this project?"
}

replace S2_15_21_0_S2_16 = 9 if S2_15_21_0_S2_16_C8=="MINIST AGRICUKTURA"
replace S2_15_21_0_S2_16 = 8 if S2_15_21_0_S2_16_C8=="Empresas Privadas"
replace S2_15_21_0_S2_16 = 8 if S2_15_21_0_S2_16_C8=="TOTAL"
replace S2_15_21_0_S2_16 = 8 if S2_15_21_0_S2_16_C8=="sonangol"
replace S2_15_21_0_S2_16 = 10 if S2_15_21_0_S2_16_C8=="MPLA"

replace S2_15_21_1_S2_16 = 11 if S2_15_21_1_S2_16_C8=="igrej"


foreach var in S2_15_21_0_S2_17 S2_15_21_1_S2_17 S2_15_21_2_S2_17{
replace `var' = 0 if `var'==2
lab var `var' "Did the parents make any cash or in-kind contributions to this project?"
}

foreach var in S2_15_21_0_S2_18 S2_15_21_1_S2_18 S2_15_21_2_S2_18{
replace `var' = . if inlist(`var',0,999999)
lab var `var' "How many people / day of work did the total contribute from the parents?"
}

foreach var in  S2_15_21_0_S2_19 S2_15_21_1_S2_19 S2_15_21_2_S2_19{
replace `var' = . if inlist(`var',0,99999999)
lab var `var' "What is the value of all materials in kind offered by parents?"
}

foreach var in  S2_15_21_0_S2_20 S2_15_21_1_S2_20 S2_15_21_2_S2_20{
replace `var' = . if inlist(`var',0,99999999)
lab var `var' "What is the parent's cash contribution to this project to date?"
}

foreach var in  S2_15_21_0_S2_21 S2_15_21_1_S2_21 S2_15_21_2_S2_21{
replace `var' = . if `var'==6
lab var `var' "The parents received a contribution or subsidy from...."
}

drop S2_15_21_0_S2_21_C5 S2_15_21_1_S2_21_C5 S2_15_21_2_S2_21_C5

#delimit ;
lab def S2_15
1 "Classrooms: construction"
2 "Classrooms: improvement (eg ceiling, wall)"
3 "Bathrooms"
4 "Sports facilities (eg multipurpose field)"
5 "Total school: construction or improvement"
6 "Other facilities: construction"
;
lab val S2_15_21_0_S2_15 S2_15_21_1_S2_15 S2_15_21_2_S2_15 S2_15
;
lab def S2_16
1 "FAS"
2 "Ministry of Education"
3 "Provincial government"
4 "Municipal administration"
5 "Parents / Guardians"
6 "Community"
7 "NGOs"
8 "Private companies"
9 "Other Ministries"
10 "Political party"
11 "Church"
;
lab val S2_15_21_0_S2_16 S2_15_21_1_S2_16 S2_15_21_2_S2_16 S2_16
;
lab val S2_15_21_0_S2_17 S2_15_21_1_S2_17 S2_15_21_2_S2_17 dummy
;
lab def S2_21
1 "Ministry"
2 "Communal or municipal administration"
3 "Community"
4 "NGOs"
;
lab val S2_15_21_0_S2_21 S2_15_21_1_S2_21 S2_15_21_2_S2_21 S2_21
;
#delimit cr

rename S2_15_21_0_S2_15 Q2_15_01
rename S2_15_21_1_S2_15 Q2_15_02
rename S2_15_21_2_S2_15 Q2_15_03

rename S2_15_21_0_S2_16 Q2_16_01
rename S2_15_21_1_S2_16 Q2_16_02
rename S2_15_21_2_S2_16 Q2_16_03

rename S2_15_21_0_S2_17 Q2_17_01
rename S2_15_21_1_S2_17 Q2_17_02
rename S2_15_21_2_S2_17 Q2_17_03

rename S2_15_21_0_S2_18 Q2_18_01
rename S2_15_21_1_S2_18 Q2_18_02
rename S2_15_21_2_S2_18 Q2_18_03

rename S2_15_21_0_S2_19 Q2_19_01
rename S2_15_21_1_S2_19 Q2_19_02
rename S2_15_21_2_S2_19 Q2_19_03

rename S2_15_21_0_S2_20 Q2_20_01
rename S2_15_21_1_S2_20 Q2_20_02
rename S2_15_21_2_S2_20 Q2_20_03

rename S2_15_21_0_S2_21 Q2_21_01
rename S2_15_21_1_S2_21 Q2_21_02
rename S2_15_21_2_S2_21 Q2_21_03

/***********************

Major problem here is that questions 17-21 were only asked if the response
to question 16 was "parents".

***********************/

lab var S2_15_21_0_S2_15_C5 "AUX"
lab var S2_15_21_1_S2_15_C5 "AUX"
lab var S2_15_21_2_S2_15_C5 "AUX"
lab var S2_15_21_0_S2_16_C8 "AUX"
lab var S2_15_21_1_S2_16_C8 "AUX"
lab var S2_15_21_2_S2_16_C8 "AUX"

order S2_B1 S2_B2 S2_B3 S2_B4 S2_B5 S2_B6 S2_B7 S2_C1 S2_C2 S2_C3 S2_C4 S2_C5 S2_C6 S2_C7 S2_15_21_0_S2_15_C5 S2_15_21_1_S2_15_C5 S2_15_21_2_S2_15_C5 S2_15_21_0_S2_16_C8 S2_15_21_1_S2_16_C8 S2_15_21_2_S2_16_C8, after(Q2_21_03)
}
********************************************************************************
********************************** SECTION 3 ***********************************
********************************************************************************
{
lab var S3_1_C1_Q1 "AUX"
lab var S3_1_C2_Q1 "AUX"
lab var S3_1_C3_Q1 "AUX"
lab var S3_1_C4_Q1 "AUX"
lab var S3_1_C5_Q1 "AUX"
lab var S3_1_C6_Q1 "AUX"
lab var S3_1_C7_Q1 "AUX"
lab var S3_1_C1_S3_21 "AUX"
lab var S3_1_C1_S3_22 "AUX"
lab var S3_1_C1_S3_23 "AUX"
lab var S3_1_C1_S3_24 "AUX"
lab var S3_1_C1_S3_25 "AUX"
lab var S3_1_C1_S3_26 "AUX"
lab var S3_1_C1_S3_27 "AUX"
lab var S3_1_C2_S3_21 "AUX"
lab var S3_1_C2_S3_22 "AUX"
lab var S3_1_C2_S3_23 "AUX"
lab var S3_1_C2_S3_24 "AUX"
lab var S3_1_C2_S3_25 "AUX"
lab var S3_1_C2_S3_26 "AUX"
lab var S3_1_C2_S3_27 "AUX"
lab var S3_1_C3_S3_21 "AUX"
lab var S3_1_C3_S3_22 "AUX"
lab var S3_1_C3_S3_23 "AUX"
lab var S3_1_C3_S3_24 "AUX"
lab var S3_1_C3_S3_25 "AUX"
lab var S3_1_C3_S3_26 "AUX"
lab var S3_1_C3_S3_27 "AUX"
lab var S3_1_C4_S3_21 "AUX"
lab var S3_1_C4_S3_22 "AUX"
lab var S3_1_C4_S3_23 "AUX"
lab var S3_1_C4_S3_24 "AUX"
lab var S3_1_C4_S3_25 "AUX"
lab var S3_1_C4_S3_26 "AUX"
lab var S3_1_C4_S3_27 "AUX"
lab var S3_1_C5_S3_21 "AUX"
lab var S3_1_C5_S3_22 "AUX"
lab var S3_1_C5_S3_23 "AUX"
lab var S3_1_C5_S3_24 "AUX"
lab var S3_1_C5_S3_25 "AUX"
lab var S3_1_C5_S3_26 "AUX"
lab var S3_1_C5_S3_27 "AUX"
lab var S3_1_C6_S3_21 "AUX"
lab var S3_1_C6_S3_22 "AUX"
lab var S3_1_C6_S3_23 "AUX"
lab var S3_1_C6_S3_24 "AUX"
lab var S3_1_C6_S3_25 "AUX"
lab var S3_1_C6_S3_26 "AUX"
lab var S3_1_C6_S3_27 "AUX"
lab var S3_1_C7_S3_21 "AUX"
lab var S3_1_C7_S3_22 "AUX"
lab var S3_1_C7_S3_23 "AUX"
lab var S3_1_C7_S3_24 "AUX"
lab var S3_1_C7_S3_25 "AUX"
lab var S3_1_C7_S3_26 "AUX"
lab var S3_1_C7_S3_27 "AUX"
lab var S3_1_C1_S3_2_C6 "AUX"
lab var S3_1_C2_S3_2_C6 "AUX"
lab var S3_1_C3_S3_2_C6 "AUX"
lab var S3_1_C4_S3_2_C6 "AUX"
lab var S3_1_C5_S3_2_C6 "AUX"
lab var S3_1_C6_S3_2_C6 "AUX"
lab var S3_1_C7_S3_2_C6 "AUX"
lab var S3_1_C1_S3_31 "AUX"
lab var S3_1_C1_S3_32 "AUX"
lab var S3_1_C1_S3_33 "AUX"
lab var S3_1_C1_S3_34 "AUX"
lab var S3_1_C1_S3_35 "AUX"
lab var S3_1_C1_S3_36 "AUX"
lab var S3_1_C2_S3_31 "AUX"
lab var S3_1_C2_S3_32 "AUX"
lab var S3_1_C2_S3_33 "AUX"
lab var S3_1_C2_S3_34 "AUX"
lab var S3_1_C2_S3_35 "AUX"
lab var S3_1_C2_S3_36 "AUX"
lab var S3_1_C3_S3_31 "AUX"
lab var S3_1_C3_S3_32 "AUX"
lab var S3_1_C3_S3_33 "AUX"
lab var S3_1_C3_S3_34 "AUX"
lab var S3_1_C3_S3_35 "AUX"
lab var S3_1_C3_S3_36 "AUX"
lab var S3_1_C4_S3_31 "AUX"
lab var S3_1_C4_S3_32 "AUX"
lab var S3_1_C4_S3_33 "AUX"
lab var S3_1_C4_S3_34 "AUX"
lab var S3_1_C4_S3_35 "AUX"
lab var S3_1_C4_S3_36 "AUX"
lab var S3_1_C5_S3_31 "AUX"
lab var S3_1_C5_S3_32 "AUX"
lab var S3_1_C5_S3_33 "AUX"
lab var S3_1_C5_S3_34 "AUX"
lab var S3_1_C5_S3_35 "AUX"
lab var S3_1_C5_S3_36 "AUX"
lab var S3_1_C6_S3_31 "AUX"
lab var S3_1_C6_S3_32 "AUX"
lab var S3_1_C6_S3_33 "AUX"
lab var S3_1_C6_S3_34 "AUX"
lab var S3_1_C6_S3_35 "AUX"
lab var S3_1_C6_S3_36 "AUX"
lab var S3_1_C7_S3_31 "AUX"
lab var S3_1_C7_S3_32 "AUX"
lab var S3_1_C7_S3_33 "AUX"
lab var S3_1_C7_S3_34 "AUX"
lab var S3_1_C7_S3_35 "AUX"
lab var S3_1_C7_S3_36 "AUX"
lab var S3_1_C1_S3_3_C5 "AUX"
lab var S3_1_C2_S3_3_C5 "AUX"
lab var S3_1_C3_S3_3_C5 "AUX"
lab var S3_1_C4_S3_3_C5 "AUX"
lab var S3_1_C5_S3_3_C5 "AUX"
lab var S3_1_C6_S3_3_C5 "AUX"
lab var S3_1_C7_S3_3_C5 "AUX"
lab var S3_1_0 "AUX"
lab var S3_1_1_C1_Q0 "AUX"
lab var S3_1_1_C1_Q1 "AUX"
lab var S3_1_1_C1_S3_21 "AUX"
lab var S3_1_1_C1_S3_22 "AUX"
lab var S3_1_1_C1_S3_23 "AUX"
lab var S3_1_1_C1_S3_24 "AUX"
lab var S3_1_1_C1_S3_25 "AUX"
lab var S3_1_1_C1_S3_26 "AUX"
lab var S3_1_1_C1_S3_27 "AUX"
lab var S3_1_1_C1_S3_2_C6 "AUX"
lab var S3_1_1_C1_S3_31 "AUX"
lab var S3_1_1_C1_S3_32 "AUX"
lab var S3_1_1_C1_S3_33 "AUX"
lab var S3_1_1_C1_S3_34 "AUX"
lab var S3_1_1_C1_S3_35 "AUX"
lab var S3_1_1_C1_S3_36 "AUX"
lab var S3_1_1_C1_S3_3_C5 "AUX"

rename S3_1_C1_Q1 books_lib
rename S3_1_C2_Q1 desks
rename S3_1_C3_Q1 chairs
rename S3_1_C4_Q1 chalkboards
rename S3_1_C5_Q1 books_ponto
rename S3_1_C6_Q1 books_exc
rename S3_1_C7_Q1 eduposters

*NOTE S3_1_C1_Q1*
*there might have been no space of 4 digit numbers, so 999 could mean larger than 1000*

forval n=1/7{
egen total`n' = rowtotal(S3_1_C`n'_S3_21 S3_1_C`n'_S3_22 S3_1_C`n'_S3_23 S3_1_C`n'_S3_24 S3_1_C`n'_S3_25 S3_1_C`n'_S3_26 S3_1_C`n'_S3_27)
}

replace S3_1_C2_S3_26 = 0 if total2==2
replace S3_1_C5_S3_26 = 0 if total5==2
replace S3_1_C7_S3_26 = 0 if total7==2

drop total*

*NOTE: S3_2*
*none of the responses in 'others' are responding to the questions and therefore ignored here*

gen books_lib_q2 = .

forval n=1/7{
replace books_lib_q2 = `n' if S3_1_C1_S3_2`n'==1
}

gen desks_q2 = .

forval n=1/7{
replace desks_q2 = `n' if S3_1_C2_S3_2`n'==1
}

gen chairs_q2 = .

forval n=1/7{
replace chairs_q2 = `n' if S3_1_C3_S3_2`n'==1
}

gen chalkboards_q2 = .

forval n=1/7{
replace chalkboards_q2 = `n' if S3_1_C4_S3_2`n'==1
}

gen books_ponto_q2 = .

forval n=1/7{
replace books_ponto_q2 = `n' if S3_1_C5_S3_2`n'==1
}

gen books_exc_q2 = .

forval n=1/7{
replace books_exc_q2 = `n' if S3_1_C6_S3_2`n'==1
}

gen eduposters_q2 = .

forval n=1/7{
replace eduposters_q2 = `n' if S3_1_C7_S3_2`n'==1
}


rename S3_1_C1_S3_2_C6 books_lib_q2oth
rename S3_1_C2_S3_2_C6 desks_q2oth
rename S3_1_C3_S3_2_C6 chairs_q2oth
rename S3_1_C4_S3_2_C6 chalkboards_q2oth
rename S3_1_C5_S3_2_C6 books_ponto_q2oth
rename S3_1_C6_S3_2_C6 books_exc_q2oth
rename S3_1_C7_S3_2_C6 eduposters_q2oth

forval n=1/6{
egen total`n' = rowtotal(S3_1_C`n'_S3_31 S3_1_C`n'_S3_32 S3_1_C`n'_S3_33 S3_1_C`n'_S3_34 S3_1_C`n'_S3_35 S3_1_C`n'_S3_36)
}

replace S3_1_C3_S3_34 = 0 if total3==2

gen books_lib_q3 = .

forval n=1/6{
replace books_lib_q3 = `n' if S3_1_C1_S3_3`n'==1
}

gen desks_q3 = .

forval n=1/6{
replace desks_q3 = `n' if S3_1_C2_S3_3`n'==1
}

gen chairs_q3 = .

forval n=1/6{
replace chairs_q3 = `n' if S3_1_C3_S3_3`n'==1
}

gen chalkboards_q3 = .

forval n=1/6{
replace chalkboards_q3 = `n' if S3_1_C4_S3_3`n'==1
}

gen books_ponto_q3 = .

forval n=1/6{
replace books_ponto_q3 = `n' if S3_1_C5_S3_3`n'==1
}

gen books_exc_q3 = .

forval n=1/6{
replace books_exc_q3 = `n' if S3_1_C6_S3_3`n'==1
}

gen eduposters_q3 = .

forval n=1/6{
replace eduposters_q3 = `n' if S3_1_C7_S3_3`n'==1
}

recode books_lib_q3		(6=7)
recode desks_q3			(6=7)
recode chairs_q3 		(6=7)
recode chalkboards_q3 	(6=7)
recode books_ponto_q3 	(6=7)
recode books_exc_q3 	(6=7)
recode eduposters_q3	(6=7)

replace books_lib_q3 = 6 if S3_1_C1_S3_3_C5=="fundo lwini"
replace books_lib_q3 = 6 if S3_1_C1_S3_3_C5=="Empresa portuguesa"

replace desks_q3 = 4 if S3_1_C2_S3_3_C5=="Coordenação comunal"
replace desks_q3 = 6 if S3_1_C2_S3_3_C5=="Empresas"

replace chairs_q3 = 4 if S3_1_C3_S3_3_C5=="Coordenação comunal"
replace chairs_q3 = 6 if S3_1_C3_S3_3_C5=="Empresas patrocinadoras"

replace chalkboards_q3 = 4 if S3_1_C4_S3_3_C5=="Coordenação comunal"
replace chalkboards_q3 = 6 if S3_1_C4_S3_3_C5=="Empresa patrocinadora"

replace books_ponto_q3 = 4 if S3_1_C5_S3_3_C5=="Coordenação comunal"

rename S3_1_C1_S3_3_C5 books_lib_q3oth
rename S3_1_C2_S3_3_C5 desks_q3oth
rename S3_1_C3_S3_3_C5 chairs_q3oth
rename S3_1_C4_S3_3_C5 chalkboards_q3oth
rename S3_1_C5_S3_3_C5 books_ponto_q3oth
rename S3_1_C6_S3_3_C5 books_exc_q3oth
rename S3_1_C7_S3_3_C5 eduposters_q3oth

foreach var in  S3_1_1_C1_Q1 S3_1_1_C1_S3_21 S3_1_1_C1_S3_22 S3_1_1_C1_S3_23 S3_1_1_C1_S3_24 S3_1_1_C1_S3_25 S3_1_1_C1_S3_26 S3_1_1_C1_S3_27 S3_1_1_C1_S3_31 S3_1_1_C1_S3_32 S3_1_1_C1_S3_33 S3_1_1_C1_S3_34 S3_1_1_C1_S3_35 S3_1_1_C1_S3_36  {
replace `var' = . if S3_1_0==2
}

gen maps_aux = 1 if S3_1_1_C1_Q0=="MAPAS"
replace maps_aux = 1 if S3_1_1_C1_Q0=="Mapas"
replace maps_aux = 1 if S3_1_1_C1_Q0=="Mapas e tabela periodica, estojo matemática"
replace maps_aux = 1 if S3_1_1_C1_Q0=="mapa mundo e mapa de África"
replace maps_aux = 1 if S3_1_1_C1_Q0=="mapas"
replace maps_aux = 1 if S3_1_1_C1_Q0=="mapa"
replace maps_aux = 0 if maps_aux==.

gen maps = S3_1_1_C1_Q1 if maps_aux==1
replace maps = 0 if maps_aux==0

forval n=1/7 {
gen maps_q2_`n' = S3_1_1_C1_S3_2`n' if maps_aux==1
}

forval n=1/6 {
gen maps_q3_`n' = S3_1_1_C1_S3_3`n' if maps_aux==1
}

gen clipboards_aux = 1 if S3_1_1_C1_Q0=="Pranchetas"
replace clipboards_aux = 1 if S3_1_1_C1_Q0=="pranche5as"
replace clipboards_aux = 1 if S3_1_1_C1_Q0=="pranchetas"
replace clipboards_aux = 0 if clipboards_aux==.

gen clipboards = S3_1_1_C1_Q1 if clipboards_aux==1
replace clipboards = 0 if clipboards_aux==0

forval n=1/7 {
gen clipboards_q2_`n' = S3_1_1_C1_S3_2`n' if clipboards_aux==1
}

forval n=1/6 {
gen clipboards_q3_`n' = S3_1_1_C1_S3_3`n' if clipboards_aux==1
}

gen others_aux = 1 if S3_1_1_C1_Q0=="Pastas de arquivo, Amários para arquivo"
replace others_aux = 1 if S3_1_1_C1_Q0=="Armarios para arquivo, bebetório(agua)"
replace others_aux = 1 if S3_1_1_C1_Q0=="Maquina dactigráfa"
replace others_aux = 1 if S3_1_1_C1_Q0=="Esojos de matemática"
replace others_aux = 1 if S3_1_1_C1_Q0=="carteiras"
replace others_aux = 0 if others_aux==.

gen others = S3_1_1_C1_Q1 if others_aux==1
replace others = 0 if others_aux==0

forval n=1/7 {
gen others_q2_`n' = S3_1_1_C1_S3_2`n' if others_aux==1
}

forval n=1/6 {
gen others_q3_`n' = S3_1_1_C1_S3_3`n' if others_aux==1
}

gen maps_q2 = .

forval n=1/7{
replace maps_q2 = `n' if maps_q2_`n'==1
}
gen clipboards_q2 = .

forval n=1/7{
replace clipboards_q2 = `n' if clipboards_q2_`n'==1
}

gen others_q2 = .

forval n=1/7{
replace others_q2 = `n' if others_q2_`n'==1
}

gen maps_q3 = .

forval n=1/6{
replace maps_q3 = `n' if maps_q3_`n'==1
}

gen clipboards_q3 = .

forval n=1/6{
replace clipboards_q3 = `n' if clipboards_q3_`n'==1
}
gen others_q3 = .

forval n=1/6{
replace others_q3 = `n' if others_q3_`n'==1
}
recode maps_q3			(6=7)
recode clipboards_q3	(6=7)
recode others_q3		(6=7)

gen S3_1_1_C1_S3_3_C5_maps = S3_1_1_C1_S3_3_C5 if maps_aux==1
gen S3_1_1_C1_S3_3_C5_clipboards = S3_1_1_C1_S3_3_C5 if clipboards_aux==1
gen S3_1_1_C1_S3_3_C5_others = S3_1_1_C1_S3_3_C5 if others_aux==1

drop S3_1_1_C1_S3_3_C5_maps S3_1_1_C1_S3_3_C5_clipboards S3_1_1_C1_S3_3_C5_others

replace clipboards_q3 = 4 if S3_1_1_C1_S3_3_C5=="Coordenação comunal"

gen maps_q3oth = S3_1_1_C1_S3_3_C5 if maps_aux==1
gen clipboards_q3oth = S3_1_1_C1_S3_3_C5 if clipboards_aux==1
gen others_q3oth = S3_1_1_C1_S3_3_C5 if others_aux==1

#delimit;
lab def s3_q2
1 "Received resources directly"
2 "The funds were deposited in the school account"
3 "Received funds directly and funds were deposited into school account"
4 "The funds were handed over to the director of the school"
5 "The funds were delivered directly to the direction of the school"
6 "Other"
7 "No funds were received for this"
;
lab val books_lib_q2 desks_q2 chairs_q2 chalkboards_q2 books_ponto_q2 books_exc_q2 eduposters_q2 maps_q2 clipboards_q2 others_q2 s3_q2
;
lab def s3_q3
1 "Parents"
2 "Local business"
3 "NGO"
4 "Community"
5 "Government: state, province, ministry or municipal repartition"
6 "Other"
7 "No funds were received for this"
;
lab val books_lib_q3 desks_q3 chairs_q3 chalkboards_q3 books_ponto_q3 books_exc_q3 eduposters_q3 maps_q3 clipboards_q3 others_q3 s3_q3
;
#delimit cr

order maps clipboards others books_lib_q2 desks_q2 chairs_q2 chalkboards_q2 books_ponto_q2 books_exc_q2 eduposters_q2 maps_q2 clipboards_q2 others_q2 books_lib_q2oth desks_q2oth chairs_q2oth chalkboards_q2oth books_ponto_q2oth books_exc_q2oth eduposters_q2oth books_lib_q3 desks_q3 chairs_q3 chalkboards_q3 books_ponto_q3 books_exc_q3 eduposters_q3 maps_q3 clipboards_q3 others_q3 books_lib_q3oth desks_q3oth chairs_q3oth chalkboards_q3oth books_ponto_q3oth books_exc_q3oth eduposters_q3oth maps_q3oth clipboards_q3oth others_q3oth, after(eduposters)

order total1 total2 total3 total4 total5 total6 maps_aux maps_q2_1 maps_q2_2 maps_q2_3 maps_q2_4 maps_q2_5 maps_q2_6 maps_q2_7 maps_q3_1 maps_q3_2 maps_q3_3 maps_q3_4 maps_q3_5 maps_q3_6 clipboards_aux clipboards_q2_1 clipboards_q2_2 clipboards_q2_3 clipboards_q2_4 clipboards_q2_5 clipboards_q2_6 clipboards_q2_7 clipboards_q3_1 clipboards_q3_2 clipboards_q3_3 clipboards_q3_4 clipboards_q3_5 clipboards_q3_6 others_aux others_q2_1 others_q2_2 others_q2_3 others_q2_4 others_q2_5 others_q2_6 others_q2_7 others_q3_1 others_q3_2 others_q3_3 others_q3_4 others_q3_5 others_q3_6, after(others_q3oth)

lab var total1 "AUX section 3"
lab var total2 "AUX section 3"
lab var total3 "AUX section 3"
lab var total4 "AUX section 3"
lab var total5 "AUX section 3"
lab var total6 "AUX section 3"
lab var maps_aux "AUX section 3"
lab var maps_q2_1 "AUX section 3"
lab var maps_q2_2 "AUX section 3"
lab var maps_q2_3 "AUX section 3"
lab var maps_q2_4 "AUX section 3"
lab var maps_q2_5 "AUX section 3"
lab var maps_q2_6 "AUX section 3"
lab var maps_q2_7 "AUX section 3"
lab var maps_q3_1 "AUX section 3"
lab var maps_q3_2 "AUX section 3"
lab var maps_q3_3 "AUX section 3"
lab var maps_q3_4 "AUX section 3"
lab var maps_q3_5 "AUX section 3"
lab var maps_q3_6 "AUX section 3"
lab var clipboards_aux "AUX section 3"
lab var clipboards_q2_1 "AUX section 3"
lab var clipboards_q2_2 "AUX section 3"
lab var clipboards_q2_3 "AUX section 3"
lab var clipboards_q2_4 "AUX section 3"
lab var clipboards_q2_5 "AUX section 3"
lab var clipboards_q2_6 "AUX section 3"
lab var clipboards_q2_7 "AUX section 3"
lab var clipboards_q3_1 "AUX section 3"
lab var clipboards_q3_2 "AUX section 3"
lab var clipboards_q3_3 "AUX section 3"
lab var clipboards_q3_4 "AUX section 3"
lab var clipboards_q3_5 "AUX section 3"
lab var clipboards_q3_6 "AUX section 3"
lab var others_aux "AUX section 3"
lab var others_q2_1 "AUX section 3"
lab var others_q2_2 "AUX section 3"
lab var others_q2_3 "AUX section 3"
lab var others_q2_4 "AUX section 3"
lab var others_q2_5 "AUX section 3"
lab var others_q2_6 "AUX section 3"
lab var others_q2_7 "AUX section 3"
lab var others_q3_1 "AUX section 3"
lab var others_q3_2 "AUX section 3"
lab var others_q3_3 "AUX section 3"
lab var others_q3_4 "AUX section 3"
lab var others_q3_5 "AUX section 3"
lab var others_q3_6 "AUX section 3"

lab var books_lib "Number of books"
lab var desks "Number of desks"
lab var chairs "Number of chairs"
lab var chalkboards "Number of chalkboards"
lab var books_ponto "Number of books de ponto"
lab var books_exc "Number of exercise books"
lab var eduposters "Number of education posters"
lab var maps "Number of maps"
lab var clipboards "Number of clipboards"
lab var others "Number of other material"
lab var books_lib_q2 "The school received a contribution for books"
lab var desks_q2 "The school received a contribution for desks"
lab var chairs_q2 "The school received a contribution for chairs"
lab var chalkboards_q2 "The school received a contribution for chalkboards"
lab var books_ponto_q2 "The school received a contribution for books de ponto"
lab var books_exc_q2 "The school received a contribution for exercise books"
lab var eduposters_q2 "The school received a contribution for education posters"
lab var maps_q2 "The school received a contribution for maps"
lab var clipboards_q2 "The school received a contribution for clipboards"
lab var others_q2 "The school received a contribution for other materials"
lab var books_lib_q2oth "Other option for question 2 (books)"
lab var desks_q2oth "Other option for question 2 (desks)"
lab var chairs_q2oth "Other option for question 2 (chairs)"
lab var chalkboards_q2oth "Other option for question 2 (chalkboards)"
lab var books_ponto_q2oth "Other option for question 2 (books de ponto)"
lab var books_exc_q2oth "Other option for question 2 (exercise books)"
lab var eduposters_q2oth "Other option for question 2 (education posters)"
lab var books_lib_q3 "Source of contribution for books"
lab var desks_q3 "Source of contribution for desks"
lab var chairs_q3 "Source of contribution for chairs"
lab var chalkboards_q3 "Source of contribution for chalkboards"
lab var books_ponto_q3 "Source of contribution for books de ponto"
lab var books_exc_q3 "Source of contribution for exercise books"
lab var eduposters_q3 "Source of contribution for education posters"
lab var maps_q3 "Source of contribution for maps"
lab var clipboards_q3 "Source of contribution for clipboards"
lab var others_q3 "Source of contribution for other materials"
lab var books_lib_q3oth "Other option for question 3 (books)"
lab var desks_q3oth "Other option for question 3 (desks)"
lab var chairs_q3oth "Other option for question 3 (chairs)"
lab var chalkboards_q3oth "Other option for question 3 (chalkboards)"
lab var books_ponto_q3oth "Other option for question 3 (books de ponto)"
lab var books_exc_q3oth "Other option for question 3 (exercise books)"
lab var eduposters_q3oth "Other option for question 3 (education posters)"
lab var maps_q3oth "Other option for question 3 (maps)"
lab var clipboards_q3oth "Other option for question 3 (clipboards)"
lab var others_q3oth "Other option for question 3 (other materials)"

rename (books_lib desks chairs chalkboards books_ponto books_exc eduposters maps clipboards others books_lib_q2 desks_q2 chairs_q2 chalkboards_q2 books_ponto_q2 books_exc_q2 eduposters_q2 maps_q2 clipboards_q2 others_q2 books_lib_q2oth desks_q2oth chairs_q2oth chalkboards_q2oth books_ponto_q2oth books_exc_q2oth eduposters_q2oth books_lib_q3 desks_q3 chairs_q3 chalkboards_q3 books_ponto_q3 books_exc_q3 eduposters_q3 maps_q3 clipboards_q3 others_q3 books_lib_q3oth desks_q3oth chairs_q3oth chalkboards_q3oth books_ponto_q3oth books_exc_q3oth eduposters_q3oth maps_q3oth clipboards_q3oth others_q3oth) Q3_=
rename (total1 total2 total3 total4 total5 total6 maps_aux maps_q2_1 maps_q2_2 maps_q2_3 maps_q2_4 maps_q2_5 maps_q2_6 maps_q2_7 maps_q3_1 maps_q3_2 maps_q3_3 maps_q3_4 maps_q3_5 maps_q3_6 clipboards_aux clipboards_q2_1 clipboards_q2_2 clipboards_q2_3 clipboards_q2_4 clipboards_q2_5 clipboards_q2_6 clipboards_q2_7 clipboards_q3_1 clipboards_q3_2 clipboards_q3_3 clipboards_q3_4 clipboards_q3_5 clipboards_q3_6 others_aux others_q2_1 others_q2_2 others_q2_3 others_q2_4 others_q2_5 others_q2_6 others_q2_7 others_q3_1 others_q3_2 others_q3_3 others_q3_4 others_q3_5 others_q3_6) S3_=
}
********************************************************************************
********************************** SECTION 4 (1) *******************************
********************************************************************************
{
drop S4_1_C1_Ano1_Codes S4_1_C2_Ano1_Codes S4_1_C3_Ano1_Codes S4_1_C4_Ano1_Codes S4_1_C5_Ano1_Codes S4_1_C6_Ano1_Codes S4_1_C7_Ano1_Codes S4_1_C8_Ano1_Codes S4_1_C9_Ano1_Codes S4_1_C1_Ano2_Codes S4_1_C2_Ano2_Codes S4_1_C3_Ano2_Codes S4_1_C4_Ano2_Codes S4_1_C5_Ano2_Codes S4_1_C6_Ano2_Codes S4_1_C7_Ano2_Codes S4_1_C8_Ano2_Codes S4_1_C9_Ano2_Codes S4_1_C1_Ano3_Codes S4_1_C2_Ano3_Codes S4_1_C3_Ano3_Codes S4_1_C4_Ano3_Codes S4_1_C5_Ano3_Codes S4_1_C6_Ano3_Codes S4_1_C7_Ano3_Codes S4_1_C8_Ano3_Codes S4_1_C9_Ano3_Codes S4_1_C1_Ano4_Codes S4_1_C2_Ano4_Codes S4_1_C3_Ano4_Codes S4_1_C4_Ano4_Codes S4_1_C5_Ano4_Codes S4_1_C6_Ano4_Codes S4_1_C7_Ano4_Codes S4_1_C8_Ano4_Codes S4_1_C9_Ano4_Codes S4_1_C1_Ano5_Codes S4_1_C2_Ano5_Codes S4_1_C3_Ano5_Codes S4_1_C4_Ano5_Codes S4_1_C5_Ano5_Codes S4_1_C6_Ano5_Codes S4_1_C7_Ano5_Codes S4_1_C8_Ano5_Codes S4_1_C9_Ano5_Codes S4_1_C1_Ano6_Codes S4_1_C2_Ano6_Codes S4_1_C3_Ano6_Codes S4_1_C4_Ano6_Codes S4_1_C5_Ano6_Codes S4_1_C6_Ano6_Codes S4_1_C7_Ano6_Codes S4_1_C8_Ano6_Codes S4_1_C9_Ano6_Codes S4_1_C1_Ano7_Codes S4_1_C2_Ano7_Codes S4_1_C3_Ano7_Codes S4_1_C4_Ano7_Codes S4_1_C5_Ano7_Codes S4_1_C6_Ano7_Codes S4_1_C7_Ano7_Codes S4_1_C8_Ano7_Codes S4_1_C9_Ano7_Codes S4_1_C1_Ano8_Codes S4_1_C2_Ano8_Codes S4_1_C3_Ano8_Codes S4_1_C4_Ano8_Codes S4_1_C5_Ano8_Codes S4_1_C6_Ano8_Codes S4_1_C7_Ano8_Codes S4_1_C8_Ano8_Codes S4_1_C9_Ano8_Codes S4_1_C1_Ano9_Codes S4_1_C2_Ano9_Codes S4_1_C3_Ano9_Codes S4_1_C4_Ano9_Codes S4_1_C5_Ano9_Codes S4_1_C6_Ano9_Codes S4_1_C7_Ano9_Codes S4_1_C8_Ano9_Codes S4_1_C9_Ano9_Codes

*** Students (boys and girls) ***

forval n=1/9{
rename S4_1_C1_Ano`n' students_year`n'
gen boys_year`n' = students_year`n' - S4_1_C2_Ano`n'
rename S4_1_C2_Ano`n' girls_year`n'
}

* misstake in data:
replace girls_year2 = . if school_id==96
replace boys_year2 = . if school_id==96

*STUDENTS
egen students = rowtotal(students_year*), missing
replace students = . if school_id==72
forval n=1/9{
replace students_year`n' = . if school_id==72
}
*** adding zero students instead of missing when lower classes have students:
forval n=1/9{
replace students_year`n' = 0 if students!=. & students_year`n'==.
}
* BOYS
egen boys = rowtotal(boys_year*), missing
replace boys = . if inlist(school_id,22,52,72,79)
forval n=1/9{
replace boys_year`n' = . if inlist(school_id,22,52,72,79)
}
*** adding zero students instead of missing when lower classes have students:
forval n=1/9{
replace boys_year`n' = 0 if boys!=. & boys_year`n'==.
}
* GIRLS
egen girls = rowtotal(girls_year*), missing
replace girls = . if inlist(school_id,22,52,72,79)
forval n=1/9{
replace girls_year`n' = . if inlist(school_id,22,52,72,79)
}
*** adding zero students instead of missing when lower classes have students:
forval n=1/9{
replace girls_year`n' = 0 if girls!=. & girls_year`n'==.
}


*** Repetitions (boys and girls) ***


forval n=1/9{
rename S4_1_C3_Ano`n' boysrep_year`n'
rename S4_1_C4_Ano`n' girlsrep_year`n'
}

* getting rid of misstakes
forval n=1/9{
gen varb`n' = 1 if boysrep_year`n'>boys_year`n'
replace varb`n'=. if boysrep_year`n'==. | boys_year`n'==.
replace boysrep_year`n'=. if varb`n'==1
}

forval n=1/9{
gen varg`n' = 1 if girlsrep_year`n'>girls_year`n'
replace varg`n'=. if girlsrep_year`n'==. | girls_year`n'==.
replace girlsrep_year`n'=. if varg`n'==1
}

egen boysrep = rowtotal(boysrep_year*), missing
egen girlsrep = rowtotal(girlsrep_year*), missing

drop varb* varg*

*** Classes ***


forval n=1/9{
rename S4_1_C5_Ano`n' classes_year`n'
}

egen classes = rowtotal(classes_year*), missing


replace classes = . if school_id==72
forval n=1/9{
replace classes_year`n' = . if school_id==72
}

*** adding zero classes instead of missing when lower classes have classes:
forval n=1/9{
replace classes_year`n' = 0 if classes!=. & classes_year`n'==.
}



*** Average class size ***

forval n=1/9{
gen avgsizeclass_year`n' = students_year`n'/classes_year`n'
}

*(many strange things)

gen avgsizeclass = students/classes


*** Last year ***

replace S4_1_C7_Ano5 = 116 if S4_1_C7_Ano5==1116

forval n=1/9{
rename S4_1_C6_Ano`n' studentslastye_year`n'
gen boyslastye_year`n' = studentslastye_year`n' - S4_1_C7_Ano`n'
rename S4_1_C7_Ano`n' girlslastye_year`n'
}

replace studentslastye_year2=. if school_id==67
replace boyslastye_year2=. if school_id==67


egen studentslastye = rowtotal(studentslastye_year*), missing
egen boyslastye = rowtotal(boyslastye_year*), missing
egen girlslastye = rowtotal(girlslastye_year*), missing

*** adding zero students instead of missing when lower classes have students:
forval n=1/9{
replace studentslastye_year`n' = 0 if studentslastye!=. & studentslastye_year`n'==.
}

*** adding zero students instead of missing when lower classes have students:
forval n=1/9{
replace girlslastye_year`n' = 0 if girlslastye!=. & girlslastye_year`n'==.
}

*** adding zero students instead of missing when lower classes have students:
forval n=1/9{
replace boyslastye_year`n' = 0 if boyslastye!=. & boyslastye_year`n'==.
}


*** Drop-outs ***


forval n=1/9{
rename S4_1_C8_Ano`n' boysdrop_year`n'
rename S4_1_C9_Ano`n' girlsdrop_year`n'
}


* getting rid of misstakes
forval n=1/9{
gen varb`n' = 1 if boysdrop_year`n'>boyslastye_year`n'
replace varb`n'=. if boysdrop_year`n'==. | boyslastye_year`n'==.
replace boysdrop_year`n'=. if varb`n'==1
}

forval n=1/9{
gen varg`n' = 1 if girlsdrop_year`n'>girlslastye_year`n'
replace varg`n'=. if girlsdrop_year`n'==. | girlslastye_year`n'==.
replace girlsdrop_year`n'=. if varg`n'==1
}

drop varb* varg*


egen boysdrop = rowtotal(boysdrop_year*), missing
egen girlsdrop = rowtotal(girlsdrop_year*), missing

replace boysdrop_year9=.
replace girlsdrop_year9=.


/*

*	NOTE boysdrop_year9 girlsdrop_year9 :

These variables should not exist, but they do.

*/


lab var students_year1 "Number of students in year 1"
lab var boys_year1 "Number of boys in year 1"
lab var girls_year1 "Number of girls in year 1"
lab var boysrep_year1 "Number of boys repeating year 1"
lab var girlsrep_year1 "Number of girls repeating year 1"
lab var classes_year1 "Number of classes in year 1"
lab var studentslastye_year1 "Number of students last year in year 1"
lab var boyslastye_year1 "Number of boys last year in year 1"
lab var girlslastye_year1 "Number of girls last year in year 1"
lab var boysdrop_year1 "Number of boy dropouts year 1"
lab var girlsdrop_year1 "Number of girl dropouts year 1"
lab var students_year2 "Number of students in year 2"
lab var boys_year2 "Number of boys in year 2"
lab var girls_year2 "Number of girls in year 2"
lab var boysrep_year2 "Number of boys repeating year 2"
lab var girlsrep_year2 "Number of girls repeating year 2"
lab var classes_year2 "Number of classes in year 2"
lab var studentslastye_year2 "Number of students last year in year 2"
lab var boyslastye_year2 "Number of boys last year in year 2"
lab var girlslastye_year2 "Number of girls last year in year 2"
lab var boysdrop_year2 "Number of boy dropouts year 2"
lab var girlsdrop_year2 "Number of girl dropouts year 2"
lab var students_year3 "Number of students in year 3"
lab var boys_year3 "Number of boys in year 3"
lab var girls_year3 "Number of girls in year 3"
lab var boysrep_year3 "Number of boys repeating year 3"
lab var girlsrep_year3 "Number of girls repeating year 3"
lab var classes_year3 "Number of classes in year 3"
lab var studentslastye_year3 "Number of students last year in year 3"
lab var boyslastye_year3 "Number of boys last year in year 3"
lab var girlslastye_year3 "Number of girls last year in year 3"
lab var boysdrop_year3 "Number of boy dropouts year 3"
lab var girlsdrop_year3 "Number of girl dropouts year 3"
lab var students_year4 "Number of students in year 4"
lab var boys_year4 "Number of boys in year 4"
lab var girls_year4 "Number of girls in year 4"
lab var boysrep_year4 "Number of boys repeating year 4"
lab var girlsrep_year4 "Number of girls repeating year 4"
lab var classes_year4 "Number of classes in year 4"
lab var studentslastye_year4 "Number of students last year in year 4"
lab var boyslastye_year4 "Number of boys last year in year 4"
lab var girlslastye_year4 "Number of girls last year in year 4"
lab var boysdrop_year4 "Number of boy dropouts year 4"
lab var girlsdrop_year4 "Number of girl dropouts year 4"
lab var students_year5 "Number of students in year 5"
lab var boys_year5 "Number of boys in year 5"
lab var girls_year5 "Number of girls in year 5"
lab var boysrep_year5 "Number of boys repeating year 5"
lab var girlsrep_year5 "Number of girls repeating year 5"
lab var classes_year5 "Number of classes in year 5"
lab var studentslastye_year5 "Number of students last year in year 5"
lab var boyslastye_year5 "Number of boys last year in year 5"
lab var girlslastye_year5 "Number of girls last year in year 5"
lab var boysdrop_year5 "Number of boy dropouts year 5"
lab var girlsdrop_year5 "Number of girl dropouts year 5"
lab var students_year6 "Number of students in year 6"
lab var boys_year6 "Number of boys in year 6"
lab var girls_year6 "Number of girls in year 6"
lab var boysrep_year6 "Number of boys repeating year 6"
lab var girlsrep_year6 "Number of girls repeating year 6"
lab var classes_year6 "Number of classes in year 6"
lab var studentslastye_year6 "Number of students last year in year 6"
lab var boyslastye_year6 "Number of boys last year in year 6"
lab var girlslastye_year6 "Number of girls last year in year 6"
lab var boysdrop_year6 "Number of boy dropouts year 6"
lab var girlsdrop_year6 "Number of girl dropouts year 6"
lab var students_year7 "Number of students in year 7"
lab var boys_year7 "Number of boys in year 7"
lab var girls_year7 "Number of girls in year 7"
lab var boysrep_year7 "Number of boys repeating year 7"
lab var girlsrep_year7 "Number of girls repeating year 7"
lab var classes_year7 "Number of classes in year 7"
lab var studentslastye_year7 "Number of students last year in year 7"
lab var boyslastye_year7 "Number of boys last year in year 7"
lab var girlslastye_year7 "Number of girls last year in year 7"
lab var boysdrop_year7 "Number of boy dropouts year 7"
lab var girlsdrop_year7 "Number of girl dropouts year 7"
lab var students_year8 "Number of students in year 8"
lab var boys_year8 "Number of boys in year 8"
lab var girls_year8 "Number of girls in year 8"
lab var boysrep_year8 "Number of boys repeating year 8"
lab var girlsrep_year8 "Number of girls repeating year 8"
lab var classes_year8 "Number of classes in year 8"
lab var studentslastye_year8 "Number of students last year in year 8"
lab var boyslastye_year8 "Number of boys last year in year 8"
lab var girlslastye_year8 "Number of girls last year in year 8"
lab var boysdrop_year8 "Number of boy dropouts year 8"
lab var girlsdrop_year8 "Number of girl dropouts year 8"
lab var students_year9 "Number of students in year 9"
lab var boys_year9 "Number of boys in year 9"
lab var girls_year9 "Number of girls in year 9"
lab var boysrep_year9 "Number of boys repeating year 9"
lab var girlsrep_year9 "Number of girls repeating year 9"
lab var classes_year9 "Number of classes in year 9"
lab var studentslastye_year9 "Number of students last year in year 9"
lab var boyslastye_year9 "Number of boys last year in year 9"
lab var girlslastye_year9 "Number of girls last year in year 9"
lab var boysdrop_year9 "Number of boy dropouts year 9"
lab var girlsdrop_year9 "Number of girl dropouts year 9"
lab var students "Number of students in total"
lab var boys "Number of boys in total"
lab var girls "Number of girls in total"
lab var boysrep "Number of boys repeating total"
lab var girlsrep "Number of girls repeating total"
lab var classes "Number of classes in total"
lab var studentslastye "Number of students last year in total"
lab var boyslastye "Number of boys last year in total"
lab var girlslastye "Number of girls last year in total"
lab var boysdrop "Number of boy dropouts total"
lab var girlsdrop "Number of girl dropouts total"

lab var avgsizeclass 		"Average class size in total"
lab var avgsizeclass_year1 	"Average class size in year 1"
lab var avgsizeclass_year2 	"Average class size in year 2"
lab var avgsizeclass_year3 	"Average class size in year 3"
lab var avgsizeclass_year4 	"Average class size in year 4"
lab var avgsizeclass_year5 	"Average class size in year 5"
lab var avgsizeclass_year6 	"Average class size in year 6"
lab var avgsizeclass_year7 	"Average class size in year 7"
lab var avgsizeclass_year8 	"Average class size in year 8"
lab var avgsizeclass_year9	"Average class size in year 9"


order students boys girls boysrep girlsrep classes avgsizeclass studentslastye boyslastye girlslastye boysdrop girlsdrop, after(S3_1_1_C1_S3_3_C5)
order students_year* boys_year* girls_year* boysrep_year* girlsrep_year* classes_year* avgsizeclass_year* studentslastye_year* boyslastye_year* girlslastye_year* boysdrop_year* girlsdrop_year*, after(girlsdrop)

rename (students boys girls boysrep girlsrep classes avgsizeclass studentslastye boyslastye girlslastye boysdrop girlsdrop students_year1 students_year2 students_year3 students_year4 students_year5 students_year6 students_year7 students_year8 students_year9 boys_year1 boys_year2 boys_year3 boys_year4 boys_year5 boys_year6 boys_year7 boys_year8 boys_year9 girls_year1 girls_year2 girls_year3 girls_year4 girls_year5 girls_year6 girls_year7 girls_year8 girls_year9 boysrep_year1 boysrep_year2 boysrep_year3 boysrep_year4 boysrep_year5 boysrep_year6 boysrep_year7 boysrep_year8 boysrep_year9 girlsrep_year1 girlsrep_year2 girlsrep_year3 girlsrep_year4 girlsrep_year5 girlsrep_year6 girlsrep_year7 girlsrep_year8 girlsrep_year9 classes_year1 classes_year2 classes_year3 classes_year4 classes_year5 classes_year6 classes_year7 classes_year8 classes_year9 avgsizeclass_year1 avgsizeclass_year2 avgsizeclass_year3 avgsizeclass_year4 avgsizeclass_year5 avgsizeclass_year6 avgsizeclass_year7 avgsizeclass_year8 avgsizeclass_year9 studentslastye_year1 studentslastye_year2 studentslastye_year3 studentslastye_year4 studentslastye_year5 studentslastye_year6 studentslastye_year7 studentslastye_year8 studentslastye_year9 boyslastye_year1 boyslastye_year2 boyslastye_year3 boyslastye_year4 boyslastye_year5 boyslastye_year6 boyslastye_year7 boyslastye_year8 boyslastye_year9 girlslastye_year1 girlslastye_year2 girlslastye_year3 girlslastye_year4 girlslastye_year5 girlslastye_year6 girlslastye_year7 girlslastye_year8 girlslastye_year9 boysdrop_year1 boysdrop_year2 boysdrop_year3 boysdrop_year4 boysdrop_year5 boysdrop_year6 boysdrop_year7 boysdrop_year8 boysdrop_year9 girlsdrop_year1 girlsdrop_year2 girlsdrop_year3 girlsdrop_year4 girlsdrop_year5 girlsdrop_year6 girlsdrop_year7 girlsdrop_year8 girlsdrop_year9) Q4_=

}
********************************************************************************
********************************** SECTION 4 (2) *******************************
********************************************************************************
{

lab var S4_10 "Most common reason that led students to repeat the year in the previous school year"
lab var S4_11 "Most common reason that led students to drop out of school between the 2012 and 2013 school years?"

rename S4_10 Q4_10
replace Q4_10 = . if Q4_10==5
recode Q4_10 (4=6)
replace Q4_10 = 1 if S4_10_C5=="ausencia dos alunos"
replace Q4_10 = 1 if S4_10_C5=="ATRASO"
replace Q4_10 = 1 if S4_10_C5=="atraso de alunos"
replace Q4_10 = 3 if S4_10_C5=="falta de preoucupacação"
replace Q4_10 = 6 if S4_10_C5=="classe de transição automática"
replace Q4_10 = 6 if S4_10_C5=="reforma educativa transição automatica"
replace Q4_10 = 6 if S4_10_C5=="falta de conhecimento devido a transicao automatica"
replace Q4_10 = 4 if S4_10_C5=="Acompanhamento por parte dos encarregados de educação"
replace Q4_10 = 4 if S4_10_C5=="falta acompnhamento pais"
replace Q4_10 = 4 if S4_10_C5=="Falta de acompanhamento dos encarregados de educação"
replace Q4_10 = 4 if S4_10_C5=="Falta de acompanhamento dos pais"
replace Q4_10 = 4 if S4_10_C5=="Falta de acompanhamento pelos encarregados de educação"
replace Q4_10 = 4 if S4_10_C5=="Falta de acompanhamento por parte dos pais"
replace Q4_10 = 4 if S4_10_C5=="Falta de acompanhento dps pais"
replace Q4_10 = 4 if S4_10_C5=="fraco acompanhamento dos encarregados"
replace Q4_10 = 4 if S4_10_C5=="fraco acompanhamento dos pais"
replace Q4_10 = 4 if S4_10_C5=="fraco desempenho dos alunos, falta de acompanhamento dos encarregados"
replace Q4_10 = 4 if S4_10_C5=="fraco desempenho e acompanhamento da parte dos pais"
replace Q4_10 = 4 if S4_10_C5=="situação economica dos pais"
replace Q4_10 = 5 if S4_10_C5=="falta da merenda escolar"
replace Q4_10 = 5 if S4_10_C5=="falta de condições(sala de aulas)"
replace Q4_10 = 5 if S4_10_C5=="Falta de manuais"
replace Q4_10 = 5 if S4_10_C5=="falta de manuais e salas com numero elevado"
replace Q4_10 = 5 if S4_10_C5=="falta de material, condições de aprendizagem"
replace Q4_10 = 5 if S4_10_C5=="insuficinciacprod2ssores"


rename S4_11 Q4_11

replace Q4_11 = . if Q4_11==7
replace Q4_11 = 2 if S4_11_C7=="agricultura"
replace Q4_11 = 5 if S4_11_C7=="Mudança de residencia dos pais"
replace Q4_11 = 5 if S4_11_C7=="Os pais são nomadas e levam consigo as crinaças"
replace Q4_11 = 5 if S4_11_C7=="A distância"
replace Q4_11 = 5 if S4_11_C7=="a distância"
replace Q4_11 = 5 if S4_11_C7=="A distância das residencias"
replace Q4_11 = 5 if S4_11_C7=="casamento precpce e distancias l8ngas da escola"
replace Q4_11 = 5 if S4_11_C7=="Distância"
replace Q4_11 = 5 if S4_11_C7=="distancia das lavras para a escola"
replace Q4_11 = 5 if S4_11_C7=="distancia de suas residencias"
replace Q4_11 = 7 if S4_11_C7=="a falta da merenda escolar"
replace Q4_11 = 7 if S4_11_C7=="falta da merenda escolar"
replace Q4_11 = 7 if S4_11_C7=="falta da merenda escolares"
replace Q4_11 = 7 if S4_11_C7=="FALTA DE MERENDA ESCOLA"
replace Q4_11 = 7 if S4_11_C7=="Falta de Merenda escolar"
replace Q4_11 = 7 if S4_11_C7=="Falta merenda"
replace Q4_11 = 7 if S4_11_C7=="faltamerendas"
replace Q4_11 = 8 if S4_11_C7=="A falta de acompanhamento dos filhos por parte dos pais"
replace Q4_11 = 8 if S4_11_C7=="acompanhamento pais"
replace Q4_11 = 8 if S4_11_C7=="Fraco acompanhamento dos pais"
replace Q4_11 = 8 if S4_11_C7=="fraco acompanhamento dos pais"
replace Q4_11 = 8 if S4_11_C7=="doenças e nao acompanhamento dos encarregados"
replace Q4_11 = 2 if S4_11_C7=="CIRCUNCUSAO AGRICUKTYRA E CACS"
replace Q4_11 = 9 if S4_11_C7=="Doença"
replace Q4_11 = 9 if S4_11_C7=="doença"
replace Q4_11 = 7 if S4_11_C7=="Mau estado da escola"
replace Q4_11 = 10 if S4_11_C7=="Não acontece"
replace Q4_11 = 10 if S4_11_C7=="nao houve desistencia"
replace Q4_11 = 10 if S4_11_C7=="pouca desistencia"

lab var S4_10_C5 "AUX"
lab var S4_11_C7 "AUX"

#delimit ;
;
lab def Q4_10
1 "Were not present at school the minimum required days"
2 "Failed in terms of acquired knowledge"
3 "They had bad behavior in class"
4 "Poor parenting"
5 "Lack of school conditions such as school lunch"
6 "n/a: they did not repeat the year"
;
lab val Q4_10 Q4_10
;
lab def Q4_11
1 "Parents could not pay for school"
2 "The child had to work"
3 "Parents were not interested in schooling of children"
4 "Poor performance of children"
5 "Parents no longer reside in this community/at a distance"
6 "Children have missed school too many times"
7 "Lack of school conditions such as school lunch"
8 "Poor parenting"
9 "Health problems"
10 "n/a: there was no quitting"
;
lab val Q4_11 Q4_11
;
#delimit cr

* NOTE S4_12_13A *
/*
Only one spot for "others" unclear whether this is for a percentage or the
"other" job. Or both. Making the best out of it..
*/


replace S4_12_13A = 4 if S4_12_13A_C8=="vendedor ambulante 70"
replace S4_12_13A_N_Agric = 70 if S4_12_13A_C8=="vendedor ambulante 70"

replace S4_12_13A_C8 = "" if S4_12_13A_C8=="vendedor ambulante 70"

replace S4_12_13A = 1 if S4_12_13A_C8=="AGRICULTURA"
replace S4_12_13A_C8 = "" if S4_12_13A_C8=="AGRICULTURA"

replace S4_12_13B = . if S4_12_13B_C8=="0"
replace S4_12_13B_C8 = "" if S4_12_13B_C8=="0"

replace S4_12_13B_N_Agric = 10 if S4_12_13B_C8=="meconicos 10"
replace S4_12_13B = 4 if S4_12_13B_C8=="meconicos 10"
replace S4_12_13B_C8 = "" if S4_12_13B_C8=="meconicos 10"

replace S4_12_13B = 1 if inlist(S4_12_13B_C8,"AGRI","AGRIC","agric","agricul","agricult","agrucl")
replace S4_12_13B_C8 = "" if inlist(S4_12_13B_C8,"AGRI","AGRIC","agric","agricul","agricult","agrucl")

replace S4_12_13B = 4 if inlist(S4_12_13B_C8,"comerciantes","Negocio por conta propria","trabalham por conta propria negiciantes")
replace S4_12_13B_C8 = "" if inlist(S4_12_13B_C8,"comerciantes","Negocio por conta propria","trabalham por conta propria negiciantes")

replace S4_12_13B = 5 if S4_12_13B_C8=="func publicos"
replace S4_12_13B_C8 = "" if S4_12_13B_C8=="func publicos"

replace S4_12_13C = . if S4_12_13C_C8=="0"
replace S4_12_13C_C8 = "" if S4_12_13C_C8=="0"

replace S4_12_13C = . if S4_12_13C_C8=="nao a mais"
replace S4_12_13C_C8 = "" if S4_12_13C_C8=="nao a mais"

replace S4_12_13C = 4 if inlist(S4_12_13C_C8,"Pedreiros")
replace S4_12_13C_C8 = "" if inlist(S4_12_13C_C8,"Pedreiros")

replace S4_12_13C = 5 if inlist(S4_12_13C_C8,"func pub","FUNC PUBL")
replace S4_12_13C_C8 = "" if inlist(S4_12_13C_C8,"func pub","FUNC PUBL")

destring S4_12_13A_C8 S4_12_13B_C8 S4_12_13C_C8, replace

lab var S4_12_13A "Most common occupation parents"
lab var S4_12_13A_A_Sub "Percentage subsistence farming"
lab var S4_12_13A_A_Com "Percentage farming for comercial use"
lab var S4_12_13A_C_Gado "Percentage holding livestock"
lab var S4_12_13A_N_Agric "Percentage non-farming activity"
lab var S4_12_13A_Emprego "Percentage payroll job"
lab var S4_12_13A_Demprego "Percentage unemployed"
lab var S4_12_13A_Pesca "Percentage fisher"
lab var S4_12_13A_C8 "Percentage unidentified other job"

lab var S4_12_13B "Second most common occupation parents"
lab var S4_12_13B_A_Sub "Percentage subsistence farming"
lab var S4_12_13B_A_Com "Percentage farming for comercial use"
lab var S4_12_13B_C_Gado "Percentage holding livestock"
lab var S4_12_13B_N_Agric "Percentage non-farming activity"
lab var S4_12_13B_Emprego "Percentage payroll job"
lab var S4_12_13B_Demprego "Percentage unemployed"
lab var S4_12_13B_Pesca "Percentage fisher"
lab var S4_12_13B_C8 "Percentage unidentified other job"

lab var S4_12_13C "Third most common occupation parents"
lab var S4_12_13C_A_Sub "Percentage subsistence farming"
lab var S4_12_13C_A_Com "Percentage farming for comercial use"
lab var S4_12_13C_C_Gado "Percentage holding livestock"
lab var S4_12_13C_N_Agric "Percentage non-farming activity"
lab var S4_12_13C_Emprego "Percentage payroll job"
lab var S4_12_13C_Demprego "Percentage unemployed"
lab var S4_12_13C_Pesca "Percentage fisher"
lab var S4_12_13C_C8 "Percentage unidentified other job"

#delimit ;
;
lab def S4_12_13
1 "Subsistence agriculture (peasant)"
2 "Commercial agriculture (employs other people)"
3 "Cattle breeding"
4 "Non-agricultural business"
5 "Employee with salary"
6 "Unemployed"
7 "Fishing"
8 "Other"
;
lab val S4_12_13A S4_12_13B S4_12_13C S4_12_13
;
#delimit cr

rename S4_12_13A 			Q4_12_01
rename S4_12_13A_A_Sub 		Q4_13_01_SubAgr
rename S4_12_13A_A_Com 		Q4_13_01_ComAgr
rename S4_12_13A_C_Gado 	Q4_13_01_Cattle
rename S4_12_13A_N_Agric	Q4_13_01_NonAgr
rename S4_12_13A_Emprego 	Q4_13_01_Empl
rename S4_12_13A_Demprego 	Q4_13_01_Unempl
rename S4_12_13A_Pesca 		Q4_13_01_Fish
rename S4_12_13A_C8 		Q4_13_01_Other

rename S4_12_13B 			Q4_12_02
rename S4_12_13B_A_Sub 		Q4_13_02_SubAgr
rename S4_12_13B_A_Com 		Q4_13_02_ComAgr
rename S4_12_13B_C_Gado 	Q4_13_02_Cattle
rename S4_12_13B_N_Agric	Q4_13_02_NonAgr
rename S4_12_13B_Emprego 	Q4_13_02_Empl
rename S4_12_13B_Demprego 	Q4_13_02_Unempl
rename S4_12_13B_Pesca 		Q4_13_02_Fish
rename S4_12_13B_C8 		Q4_13_02_Other

rename S4_12_13C 			Q4_12_03
rename S4_12_13C_A_Sub 		Q4_13_03_SubAgr
rename S4_12_13C_A_Com 		Q4_13_03_ComAgr
rename S4_12_13C_C_Gado 	Q4_13_03_Cattle
rename S4_12_13C_N_Agric	Q4_13_03_NonAgr
rename S4_12_13C_Emprego 	Q4_13_03_Empl
rename S4_12_13C_Demprego 	Q4_13_03_Unempl
rename S4_12_13C_Pesca 		Q4_13_03_Fish
rename S4_12_13C_C8 		Q4_13_03_Other

*NOTE S4_14*
*I would change the way this question is asked. Or at least think about it again.

rename S4_14 Q4_14_a
recode Q4_14_a (2=0)
lab val Q4_14_a dummy
lab var Q4_14_a "Students live in the same neighbourhood as the school is in"

replace S4_14_1 = . if S4_14_1==0
lab var S4_14_1 "How many villages do students come from?"
rename S4_14_1 Q4_14_b

drop S4_14_16_5_Q1 S4_14_16_5_Q2 S4_14_16_5_Q3

lab var S4_14_16_0_Q1 "(1) Neighborhood name"
lab var S4_14_16_1_Q1 "(2) Neighborhood name"
lab var S4_14_16_2_Q1 "(3) Neighborhood name"
lab var S4_14_16_3_Q1 "(4) Neighborhood name"
lab var S4_14_16_4_Q1 "(5) Neighborhood name"
lab var S4_14_16_0_Q2 "(1) Percentage of students"
lab var S4_14_16_1_Q2 "(2) Percentage of students"
lab var S4_14_16_2_Q2 "(3) Percentage of students"
lab var S4_14_16_3_Q2 "(4) Percentage of students"
lab var S4_14_16_4_Q2 "(5) Percentage of students"
lab var S4_14_16_0_Q3 "(1) Distance to the school (in km)"
lab var S4_14_16_1_Q3 "(2) Distance to the school (in km)"
lab var S4_14_16_2_Q3 "(3) Distance to the school (in km)"
lab var S4_14_16_3_Q3 "(4) Distance to the school (in km)"
lab var S4_14_16_4_Q3 "(5) Distance to the school (in km)"

rename S4_14_16_0_Q1 Q4_14_01
rename S4_14_16_1_Q1 Q4_14_02
rename S4_14_16_2_Q1 Q4_14_03
rename S4_14_16_3_Q1 Q4_14_04
rename S4_14_16_4_Q1 Q4_14_05
rename S4_14_16_0_Q2 Q4_15_01
rename S4_14_16_1_Q2 Q4_15_02
rename S4_14_16_2_Q2 Q4_15_03
rename S4_14_16_3_Q2 Q4_15_04
rename S4_14_16_4_Q2 Q4_15_05
rename S4_14_16_0_Q3 Q4_16_01
rename S4_14_16_1_Q3 Q4_16_02
rename S4_14_16_2_Q3 Q4_16_03
rename S4_14_16_3_Q3 Q4_16_04
rename S4_14_16_4_Q3 Q4_16_05

replace Q4_15_01 = . if Q4_15_01==0
replace Q4_15_02 = . if Q4_15_02==0
replace Q4_15_03 = . if Q4_15_03==0
replace Q4_15_04 = . if Q4_15_04==0
replace Q4_15_05 = . if Q4_15_05==0

replace Q4_16_01 = . if Q4_15_01==.
replace Q4_16_02 = . if Q4_15_02==.
replace Q4_16_03 = . if Q4_15_03==.
replace Q4_16_04 = . if Q4_15_04==.
replace Q4_16_05 = . if Q4_15_05==.


lab var S4_171 "AUX"
lab var S4_172 "AUX"
lab var S4_17_C6 "AUX"

#delimit ;
;
lab def S4_17
1	"Localização da residência"
2	"Regra “1.º a inscrever-se, 1.º a ser admitidoÓ"
3	"Relações pessoais"
4	"Contribuições dos pais para a escola"
5	"Preferência se já tiver um irmão na escola"
6	"Outro. Especifique:"
;
lab val S4_171 S4_172 S4_17
;
#delimit cr

gen Q4_17_location = 1 if S4_171==1
replace Q4_17_location = 1 if S4_172==1
gen Q4_17_firstin = 1 if S4_171==2
replace Q4_17_firstin = 1 if S4_172==2
gen Q4_17_relation = 1 if S4_171==3
replace Q4_17_relation = 1 if S4_172==3
gen Q4_17_contribution = 1 if S4_171==4
replace Q4_17_contribution = 1 if S4_172==4
gen Q4_17_sibling = 1 if S4_171==5
replace Q4_17_sibling = 1 if S4_172==5

replace Q4_17_firstin= 1 if S4_17_C6=="ordem de chegada"

gen Q4_17_no = .

replace Q4_17_no= 1 if S4_17_C6=="Basta ser difciente"
replace Q4_17_no= 1 if S4_17_C6=="Encaminham os demais para a coordenação"
replace Q4_17_no= 1 if S4_17_C6=="Idade"
replace Q4_17_no= 1 if S4_17_C6=="Os que se inscrevem para a iniciação"
replace Q4_17_no= 1 if S4_17_C6=="Pela idade"
replace Q4_17_no= 1 if S4_17_C6=="Por idade"
replace Q4_17_no= 1 if S4_17_C6=="Recebem do centro Infantil"
replace Q4_17_no= 1 if S4_17_C6=="Regra da idade"
replace Q4_17_no= 1 if S4_17_C6=="dese que tenha a idade,conforme as vagas existentes"
replace Q4_17_no= 1 if S4_17_C6=="documentados"
replace Q4_17_no= 1 if S4_17_C6=="idade"
replace Q4_17_no= 1 if S4_17_C6=="idade minima conforme regulamento"
replace Q4_17_no= 1 if S4_17_C6=="matriculados"
replace Q4_17_no= 1 if S4_17_C6=="não acontece"
replace Q4_17_no= 1 if S4_17_C6=="não filtram"
replace Q4_17_no= 1 if S4_17_C6=="olhando nos processos"
replace Q4_17_no= 1 if S4_17_C6=="recebem do pique"


egen tot = rowtotal(Q4_17_location Q4_17_firstin Q4_17_relation Q4_17_contribution Q4_17_sibling),missing
replace Q4_17_no = 0 if inlist(tot,1,2)
drop tot
egen tot = rowtotal(Q4_17_location Q4_17_firstin Q4_17_relation Q4_17_contribution Q4_17_sibling Q4_17_no), missing

replace Q4_17_location 		= 0 if inlist(tot,1,2) & Q4_17_location==.
replace Q4_17_firstin 		= 0 if inlist(tot,1,2) & Q4_17_firstin==.
replace Q4_17_relation 		= 0 if inlist(tot,1,2) & Q4_17_relation==.
replace Q4_17_contribution 	= 0 if inlist(tot,1,2) & Q4_17_contribution==.
replace Q4_17_sibling 		= 0 if inlist(tot,1,2) & Q4_17_sibling==.

drop Q4_17_sibling tot

order Q4_17_location Q4_17_firstin Q4_17_relation Q4_17_contribution Q4_17_no, after(S4_17_C6)

lab val Q4_17_location Q4_17_firstin Q4_17_relation Q4_17_contribution Q4_17_no dummy
lab var Q4_17_location "New students are admitted based on where they live"
lab var Q4_17_firstin "New students are admitted on a first comes first served basis"
lab var Q4_17_relation "New students are admitted based on personal relations"
lab var Q4_17_contribution "New students are admitted based on the contribution of the parents"
lab var Q4_17_no "There are no requirements for admission"

order S4_10_C5 S4_11_C7 S4_171 S4_172 S4_17_C6, after(Q4_17_no)
}
********************************************************************************
********************************** SECTION 5 ***********************************
********************************************************************************
{
global S5_1 S5_1_0_C1_Q1_C1_Z1 S5_1_0_C1_Q1_C2_Z1 S5_1_0_C1_Q1_C3_Z1 S5_1_0_C1_Q1_C1_Z2 S5_1_0_C1_Q1_C2_Z2 S5_1_0_C1_Q1_C3_Z2 S5_1_0_C1_Q1_C1_Z3 S5_1_0_C1_Q1_C2_Z3 S5_1_0_C1_Q1_C3_Z3

foreach var in $S5_1{
replace `var' = . if `var'==3
replace `var' = 0 if `var'==2
}
lab val $S5_1 dummy

drop S5_1_C2_Q1_C1_Z1 S5_1_C2_Q1_C2_Z1 S5_1_C2_Q1_C3_Z1 S5_1_C3_Q1_C1_Z1 S5_1_C3_Q1_C2_Z1 S5_1_C3_Q1_C3_Z1 S5_1_C4_Q1_C1_Z1 S5_1_C4_Q1_C2_Z1 S5_1_C4_Q1_C3_Z1 S5_1_C5_Q1_C1_Z1 S5_1_C5_Q1_C2_Z1 S5_1_C5_Q1_C3_Z1 S5_1_C6_Q1_C1_Z1 S5_1_C6_Q1_C2_Z1 S5_1_C6_Q1_C3_Z1 S5_1_C7_Q1_C1_Z1 S5_1_C7_Q1_C2_Z1 S5_1_C7_Q1_C3_Z1
drop S5_1_C2_Q1_C1_Z2 S5_1_C2_Q1_C2_Z2 S5_1_C2_Q1_C3_Z2 S5_1_C3_Q1_C1_Z2 S5_1_C3_Q1_C2_Z2 S5_1_C3_Q1_C3_Z2 S5_1_C4_Q1_C1_Z2 S5_1_C4_Q1_C2_Z2 S5_1_C4_Q1_C3_Z2 S5_1_C5_Q1_C1_Z2 S5_1_C5_Q1_C2_Z2 S5_1_C5_Q1_C3_Z2 S5_1_C6_Q1_C1_Z2 S5_1_C6_Q1_C2_Z2 S5_1_C6_Q1_C3_Z2 S5_1_C7_Q1_C1_Z2 S5_1_C7_Q1_C2_Z2 S5_1_C7_Q1_C3_Z2
drop S5_1_C2_Q1_C1_Z3 S5_1_C2_Q1_C2_Z3 S5_1_C2_Q1_C3_Z3 S5_1_C3_Q1_C1_Z3 S5_1_C3_Q1_C2_Z3 S5_1_C3_Q1_C3_Z3 S5_1_C4_Q1_C1_Z3 S5_1_C4_Q1_C2_Z3 S5_1_C4_Q1_C3_Z3 S5_1_C5_Q1_C1_Z3 S5_1_C5_Q1_C2_Z3 S5_1_C5_Q1_C3_Z3 S5_1_C6_Q1_C1_Z3 S5_1_C6_Q1_C2_Z3 S5_1_C6_Q1_C3_Z3 S5_1_C7_Q1_C1_Z3 S5_1_C7_Q1_C2_Z3 S5_1_C7_Q1_C3_Z3


lab var S5_1_0_C1_Q1_C1_Z1 		"There are exams available for: 2013 - Male"
lab var S5_1_0_C1_Q1_C2_Z1 		"There are exams available for: 2011 - Male"
lab var S5_1_0_C1_Q1_C3_Z1 		"There are exams available for: 2009 - Male"
lab var S5_1_0_C1_Q1_C1_Z2 		"There are exams available for: 2013 - Female"
lab var S5_1_0_C1_Q1_C2_Z2 		"There are exams available for: 2011 - Female"
lab var S5_1_0_C1_Q1_C3_Z2 		"There are exams available for: 2009 - Female"
lab var S5_1_0_C1_Q1_C1_Z3 		"There are exams available for: 2013 - Female"
lab var S5_1_0_C1_Q1_C2_Z3 		"There are exams available for: 2011 - Female"
lab var S5_1_0_C1_Q1_C3_Z3 		"There are exams available for: 2009 - Female"

lab var S5_1_C2_Q1_C1_Z1_Masculino "Number of boys that took the final exam in 2013"
lab var S5_1_C2_Q1_C2_Z1_Masculino "Number of boys that took the final exam in 2011"
lab var S5_1_C2_Q1_C3_Z1_Masculino "Number of boys that took the final exam in 2009"

lab var S5_1_C3_Q1_C1_Z1_Masculino "Number of boys that failed the final exam in 2013"
lab var S5_1_C3_Q1_C2_Z1_Masculino "Number of boys that failed the final exam in 2011"
lab var S5_1_C3_Q1_C3_Z1_Masculino "Number of boys that failed the final exam in 2009"

lab var S5_1_C4_Q1_C1_Z1_Masculino "Number of boys that received 20, 19 or 18 in Mathematics in 2013"
lab var S5_1_C4_Q1_C2_Z1_Masculino "Number of boys that received 20, 19 or 18 in Mathematics in 2011"
lab var S5_1_C4_Q1_C3_Z1_Masculino "Number of boys that received 20, 19 or 18 in Mathematics in 2009"

lab var S5_1_C5_Q1_C1_Z1_Masculino "Number of boys that received 20, 19 or 18 in Portuguese in 2013"
lab var S5_1_C5_Q1_C2_Z1_Masculino "Number of boys that received 20, 19 or 18 in Portuguese in 2011"
lab var S5_1_C5_Q1_C3_Z1_Masculino "Number of boys that received 20, 19 or 18 in Portuguese in 2009"

lab var S5_1_C6_Q1_C1_Z1_Masculino "Number of boys that received 17 or 16 in Mathematics in 2013"
lab var S5_1_C6_Q1_C2_Z1_Masculino "Number of boys that received 17 or 16 in Mathematics in 2011"
lab var S5_1_C6_Q1_C3_Z1_Masculino "Number of boys that received 17 or 16 in Mathematics in 2009"

lab var S5_1_C7_Q1_C1_Z1_Masculino "Number of boys that received 17 or 16 in Portuguese in 2013"
lab var S5_1_C7_Q1_C2_Z1_Masculino "Number of boys that received 17 or 16 in Portuguese in 2011"
lab var S5_1_C7_Q1_C3_Z1_Masculino "Number of boys that received 17 or 16 in Portuguese in 2009"

lab var S5_1_C2_Q1_C1_Z2_Feminino "Number of girls that took the final exam in 2013"
lab var S5_1_C2_Q1_C2_Z2_Feminino "Number of girls that took the final exam in 2011"
lab var S5_1_C2_Q1_C3_Z2_Feminino "Number of girls that took the final exam in 2009"

lab var S5_1_C3_Q1_C1_Z2_Feminino "Number of girls that failed the final exam in 2013"
lab var S5_1_C3_Q1_C2_Z2_Feminino "Number of girls that failed the final exam in 2011"
lab var S5_1_C3_Q1_C3_Z2_Feminino "Number of girls that failed the final exam in 2009"

lab var S5_1_C4_Q1_C1_Z2_Feminino "Number of girls that received 20, 19 or 18 in Mathematics in 2013"
lab var S5_1_C4_Q1_C2_Z2_Feminino "Number of girls that received 20, 19 or 18 in Mathematics in 2011"
lab var S5_1_C4_Q1_C3_Z2_Feminino "Number of girls that received 20, 19 or 18 in Mathematics in 2009"

lab var S5_1_C5_Q1_C1_Z2_Feminino "Number of girls that received 20, 19 or 18 in Portuguese in 2013"
lab var S5_1_C5_Q1_C2_Z2_Feminino "Number of girls that received 20, 19 or 18 in Portuguese in 2011"
lab var S5_1_C5_Q1_C3_Z2_Feminino "Number of girls that received 20, 19 or 18 in Portuguese in 2009"

lab var S5_1_C6_Q1_C1_Z2_Feminino "Number of girls that received 17 or 16 in Mathematics in 2013"
lab var S5_1_C6_Q1_C2_Z2_Feminino "Number of girls that received 17 or 16 in Mathematics in 2011"
lab var S5_1_C6_Q1_C3_Z2_Feminino "Number of girls that received 17 or 16 in Mathematics in 2009"

lab var S5_1_C7_Q1_C1_Z2_Feminino "Number of girls that received 17 or 16 in Portuguese in 2013"
lab var S5_1_C7_Q1_C2_Z2_Feminino "Number of girls that received 17 or 16 in Portuguese in 2011"
lab var S5_1_C7_Q1_C3_Z2_Feminino "Number of girls that received 17 or 16 in Portuguese in 2009"

lab var S5_1_C2_Q1_C1_Z3_Total "Number of students that took the final exam in 2013"
lab var S5_1_C2_Q1_C2_Z3_Total "Number of students that took the final exam in 2011"
lab var S5_1_C2_Q1_C3_Z3_Total "Number of students that took the final exam in 2009"

lab var S5_1_C3_Q1_C1_Z3_Total "Number of students that failed the final exam in 2013"
lab var S5_1_C3_Q1_C2_Z3_Total "Number of students that failed the final exam in 2011"
lab var S5_1_C3_Q1_C3_Z3_Total "Number of students that failed the final exam in 2009"

lab var S5_1_C4_Q1_C1_Z3_Total "Number of students that received 20, 19 or 18 in Mathematics in 2013"
lab var S5_1_C4_Q1_C2_Z3_Total "Number of students that received 20, 19 or 18 in Mathematics in 2011"
lab var S5_1_C4_Q1_C3_Z3_Total "Number of students that received 20, 19 or 18 in Mathematics in 2009"

lab var S5_1_C5_Q1_C1_Z3_Total "Number of students that received 20, 19 or 18 in Portuguese in 2013"
lab var S5_1_C5_Q1_C2_Z3_Total "Number of students that received 20, 19 or 18 in Portuguese in 2011"
lab var S5_1_C5_Q1_C3_Z3_Total "Number of students that received 20, 19 or 18 in Portuguese in 2009"

lab var S5_1_C6_Q1_C1_Z3_Total "Number of students that received 17 or 16 in Mathematics in 2013"
lab var S5_1_C6_Q1_C2_Z3_Total "Number of students that received 17 or 16 in Mathematics in 2011"
lab var S5_1_C6_Q1_C3_Z3_Total "Number of students that received 17 or 16 in Mathematics in 2009"

lab var S5_1_C7_Q1_C1_Z3_Total "Number of students that received 17 or 16 in Portuguese in 2013"
lab var S5_1_C7_Q1_C2_Z3_Total "Number of students that received 17 or 16 in Portuguese in 2011"
lab var S5_1_C7_Q1_C3_Z3_Total "Number of students that received 17 or 16 in Portuguese in 2009"


rename 	S5_1_0_C1_Q1_C1_Z1	 			results_boy_13
rename 	S5_1_0_C1_Q1_C2_Z1	 			results_boy_11
rename 	S5_1_0_C1_Q1_C3_Z1	 			results_boy_09
rename 	S5_1_0_C1_Q1_C1_Z2	 			results_girl_13
rename 	S5_1_0_C1_Q1_C2_Z2	 			results_girl_11
rename 	S5_1_0_C1_Q1_C3_Z2	 			results_girl_9
rename 	S5_1_0_C1_Q1_C1_Z3	 			results_total_13
rename 	S5_1_0_C1_Q1_C2_Z3	 			results_total_11
rename 	S5_1_0_C1_Q1_C3_Z3	 			results_total_09

rename 	S5_1_C2_Q1_C1_Z1_Masculino	 	exams_boy_13
rename 	S5_1_C2_Q1_C2_Z1_Masculino	 	exams_boy_11
rename 	S5_1_C2_Q1_C3_Z1_Masculino	 	exams_boy_09
rename 	S5_1_C3_Q1_C1_Z1_Masculino	 	failed_boy_13
rename 	S5_1_C3_Q1_C2_Z1_Masculino	 	failed_boy_11
rename 	S5_1_C3_Q1_C3_Z1_Masculino	 	failed_boy_09
rename 	S5_1_C4_Q1_C1_Z1_Masculino	 	mat18plus_boy_13
rename 	S5_1_C4_Q1_C2_Z1_Masculino	 	mat18plus_boy_11
rename 	S5_1_C4_Q1_C3_Z1_Masculino	 	mat18plus_boy_09
rename 	S5_1_C5_Q1_C1_Z1_Masculino	 	pt18plus_boy_13
rename 	S5_1_C5_Q1_C2_Z1_Masculino	 	pt18plus_boy_11
rename 	S5_1_C5_Q1_C3_Z1_Masculino	 	pt18plus_boy_09
rename 	S5_1_C6_Q1_C1_Z1_Masculino	 	mat1617_boy_13
rename 	S5_1_C6_Q1_C2_Z1_Masculino	 	mat1617_boy_11
rename 	S5_1_C6_Q1_C3_Z1_Masculino	 	mat1617_boy_09
rename 	S5_1_C7_Q1_C1_Z1_Masculino	 	pt1617_boy_13
rename 	S5_1_C7_Q1_C2_Z1_Masculino	 	pt1617_boy_11
rename 	S5_1_C7_Q1_C3_Z1_Masculino	 	pt1617_boy_09


rename 	S5_1_C2_Q1_C1_Z2_Feminino	 	exams_girl_13
rename 	S5_1_C2_Q1_C2_Z2_Feminino	 	exams_girl_11
rename 	S5_1_C2_Q1_C3_Z2_Feminino	 	exams_girl_09
rename 	S5_1_C3_Q1_C1_Z2_Feminino	 	failed_girl_13
rename 	S5_1_C3_Q1_C2_Z2_Feminino	 	failed_girl_11
rename 	S5_1_C3_Q1_C3_Z2_Feminino	 	failed_girl_09
rename 	S5_1_C4_Q1_C1_Z2_Feminino	 	mat18plus_girl_13
rename 	S5_1_C4_Q1_C2_Z2_Feminino	 	mat18plus_girl_11
rename 	S5_1_C4_Q1_C3_Z2_Feminino	 	mat18plus_girl_09
rename 	S5_1_C5_Q1_C1_Z2_Feminino	 	pt18plus_girl_13
rename 	S5_1_C5_Q1_C2_Z2_Feminino	 	pt18plus_girl_11
rename 	S5_1_C5_Q1_C3_Z2_Feminino	 	pt18plus_girl_09
rename 	S5_1_C6_Q1_C1_Z2_Feminino	 	mat1617_girl_13
rename 	S5_1_C6_Q1_C2_Z2_Feminino	 	mat1617_girl_11
rename 	S5_1_C6_Q1_C3_Z2_Feminino	 	mat1617_girl_09
rename 	S5_1_C7_Q1_C1_Z2_Feminino	 	pt1617_girl_13
rename 	S5_1_C7_Q1_C2_Z2_Feminino	 	pt1617_girl_11
rename 	S5_1_C7_Q1_C3_Z2_Feminino	 	pt1617_girl_09

rename 	S5_1_C2_Q1_C1_Z3_Total	 		exams_total_13
rename 	S5_1_C2_Q1_C2_Z3_Total	 		exams_total_11
rename 	S5_1_C2_Q1_C3_Z3_Total	 		exams_total_09
rename 	S5_1_C3_Q1_C1_Z3_Total	 		failed_total_13
rename 	S5_1_C3_Q1_C2_Z3_Total	 		failed_total_11
rename 	S5_1_C3_Q1_C3_Z3_Total	 		failed_total_09
rename 	S5_1_C4_Q1_C1_Z3_Total	 		mat18plus_total_13
rename 	S5_1_C4_Q1_C2_Z3_Total	 		mat18plus_total_11
rename 	S5_1_C4_Q1_C3_Z3_Total	 		mat18plus_total_09
rename 	S5_1_C5_Q1_C1_Z3_Total	 		pt18plus_total_13
rename 	S5_1_C5_Q1_C2_Z3_Total	 		pt18plus_total_11
rename 	S5_1_C5_Q1_C3_Z3_Total	 		pt18plus_total_09
rename 	S5_1_C6_Q1_C1_Z3_Total	 		mat1617_total_13
rename 	S5_1_C6_Q1_C2_Z3_Total	 		mat1617_total_11
rename 	S5_1_C6_Q1_C3_Z3_Total	 		mat1617_total_9
rename 	S5_1_C7_Q1_C1_Z3_Total	 		pt1617_total_13
rename 	S5_1_C7_Q1_C2_Z3_Total	 		pt1617_total_11
rename 	S5_1_C7_Q1_C3_Z3_Total	 		pt1617_total_09

lab var S5_81 "The exame was supervised by teachers"
lab var S5_82 "The exame was supervised by people for outside the school"
lab var S5_8_C2 "Other supervisors specified"

rename S5_81 Q5_08_01
replace  Q5_08_01 = . if inlist(S5_8_C2,"n s aplica","ñ se aplica","nao havia turnas da 6ª classa","não houve","não se aplica","Não tem","Não tem 6ª")
lab val Q5_08_01 dummy

rename S5_82 Q5_08_02
replace  Q5_08_02 = . if inlist(S5_8_C2,"n s aplica","ñ se aplica","nao havia turnas da 6ª classa","não houve","não se aplica","Não tem","Não tem 6ª")
lab val Q5_08_02 dummy

rename S5_8_C2 Q5_08_02_o
replace  Q5_08_02_o = "" if inlist(Q5_08_02_o,"n s aplica","ñ se aplica","nao havia turnas da 6ª classa","não houve","não se aplica","Não tem","Não tem 6ª")

*NOTE: S5_8_C2*
*Hard to make some clear catagories here. Potentially still needs some work.

rename (results_boy_13 results_boy_11 results_boy_09 results_girl_13 results_girl_11 results_girl_9 results_total_13 results_total_11 results_total_09 exams_boy_13 exams_boy_11 exams_boy_09 failed_boy_13 failed_boy_11 failed_boy_09 mat18plus_boy_13 mat18plus_boy_11 mat18plus_boy_09 pt18plus_boy_13 pt18plus_boy_11 pt18plus_boy_09 mat1617_boy_13 mat1617_boy_11 mat1617_boy_09 pt1617_boy_13 pt1617_boy_11 pt1617_boy_09 exams_girl_13 exams_girl_11 exams_girl_09 failed_girl_13 failed_girl_11 failed_girl_09 mat18plus_girl_13 mat18plus_girl_11 mat18plus_girl_09 pt18plus_girl_13 pt18plus_girl_11 pt18plus_girl_09 mat1617_girl_13 mat1617_girl_11 mat1617_girl_09 pt1617_girl_13 pt1617_girl_11 pt1617_girl_09 exams_total_13 exams_total_11 exams_total_09 failed_total_13 failed_total_11 failed_total_09 mat18plus_total_13 mat18plus_total_11 mat18plus_total_09 pt18plus_total_13 pt18plus_total_11 pt18plus_total_09 mat1617_total_13 mat1617_total_11 mat1617_total_9 pt1617_total_13 pt1617_total_11 pt1617_total_09) Q5_=
}
********************************************************************************
********************************** SECTION 6 ***********************************
********************************************************************************
{
lab var S6_1 "Does the school have an annual plan covering the current mandate?"
lab var S6_2 "How many activities are included in the current annual plan?"
lab var S6_3 "Does this school maintain a teacher attendance register (for example: with arrival times)?"

lab var S6_41 "List of teachers"
lab var S6_42 "Teachers' attendance"
lab var S6_43 "School plan"
lab var S6_44 "Student exams results"
lab var S6_45 "List of school board members"
lab var S6_46 "List of committee of parent/guardian members"
lab var S6_47 "Exam schedule"
lab var S6_48 "Teacher evaluation score"
lab var S6_49 "AUX"

lab var S6_5_C1_Q1 "List of teachers: Where is it displayed?"
lab var S6_5_C2_Q1 "Teachers' attendance: Where is it displayed?"
lab var S6_5_C3_Q1 "School plan: Where is it displayed?"
lab var S6_5_C4_Q1 "Student exams results: Where is it displayed?"
lab var S6_5_C5_Q1 "List of school board members: Where is it displayed?"
lab var S6_5_C6_Q1 "List of committee of parent/guardian members: Where is it displayed?"
lab var S6_5_C7_Q1 "Exam schedule: Where is it displayed?"
lab var S6_5_C8_Q1 "Teacher evaluation score: Where is it displayed?"

lab var S6_5_C1_Q1_C6 "AUX"
lab var S6_5_C2_Q1_C6 "AUX"
lab var S6_5_C3_Q1_C6 "AUX"
lab var S6_5_C4_Q1_C6 "AUX"
lab var S6_5_C5_Q1_C6 "AUX"
lab var S6_5_C6_Q1_C6 "AUX"
lab var S6_5_C7_Q1_C6 "AUX"
lab var S6_5_C8_Q1_C6 "AUX"

rename S6_1 Q6_01
recode Q6_01 (2=0)
lab val Q6_01 dummy

rename S6_2 Q6_02
replace Q6_02 = . if Q6_01==0

rename S6_3 Q6_03
recode Q6_03 (3=0)

lab def Q6_03 0 "No" 1 "Yes, up to date" 2 "Yes, not up to date"
lab val Q6_03 Q6_03

rename S6_41 Q6_04_01
rename S6_42 Q6_04_02
rename S6_43 Q6_04_03
rename S6_44 Q6_04_04
rename S6_45 Q6_04_05
rename S6_46 Q6_04_06
rename S6_47 Q6_04_07
rename S6_48 Q6_04_08

lab val Q6_04_01 Q6_04_02 Q6_04_03 Q6_04_04 Q6_04_05 Q6_04_06 Q6_04_07 Q6_04_08 dummy

foreach var in S6_5_C1_Q1 S6_5_C2_Q1 S6_5_C3_Q1 S6_5_C4_Q1 S6_5_C5_Q1 S6_5_C6_Q1 S6_5_C7_Q1 S6_5_C8_Q1 {
replace `var' = . if `var'==6
}

replace S6_5_C1_Q1 = 6 if S6_5_C1_Q1_C6=="Secretaria"
replace S6_5_C1_Q1 = 6 if S6_5_C1_Q1_C6=="secretaria"
replace S6_5_C1_Q1 = 6 if S6_5_C1_Q1_C6=="secretária"

replace S6_5_C2_Q1 = 8 if S6_5_C2_Q1_C6=="Vitrina"
replace S6_5_C2_Q1 = 6 if S6_5_C2_Q1_C6=="Secretária"
replace S6_5_C2_Q1 = 6 if S6_5_C2_Q1_C6=="Secretaria"
replace S6_5_C2_Q1 = 6 if S6_5_C2_Q1_C6=="secretaria"
replace S6_5_C2_Q1 = 6 if S6_5_C2_Q1_C6=="secretária"

replace S6_5_C3_Q1 = 6 if S6_5_C3_Q1_C6=="Secretaria"
replace S6_5_C3_Q1 = 6 if S6_5_C3_Q1_C6=="secretaria"
replace S6_5_C3_Q1 = 6 if S6_5_C3_Q1_C6=="secretária"

replace S6_5_C4_Q1 = 4 if S6_5_C4_Q1_C6=="Coloca-se na varanda"
replace S6_5_C4_Q1 = 7 if S6_5_C4_Q1_C6=="Sala de Aulas"
replace S6_5_C4_Q1 = 8 if S6_5_C4_Q1_C6=="Vitrina"
replace S6_5_C4_Q1 = 8 if S6_5_C4_Q1_C6=="Vitrina Movel"
replace S6_5_C4_Q1 = 8 if S6_5_C4_Q1_C6=="Vitrinas"
replace S6_5_C4_Q1 = 8 if S6_5_C4_Q1_C6=="placar"
replace S6_5_C4_Q1 = 7 if S6_5_C4_Q1_C6=="salas"
replace S6_5_C4_Q1 = 8 if S6_5_C4_Q1_C6=="vitrina"
replace S6_5_C4_Q1 = 8 if S6_5_C4_Q1_C6=="vitrina improvisada"
replace S6_5_C4_Q1 = 6 if S6_5_C4_Q1_C6=="Secretaria"
replace S6_5_C4_Q1 = 6 if S6_5_C4_Q1_C6=="frente a secretaria"
replace S6_5_C4_Q1 = 6 if S6_5_C4_Q1_C6=="secretaria"

replace S6_5_C5_Q1 = 8 if S6_5_C5_Q1_C6=="vitrina"
replace S6_5_C5_Q1 = 6 if S6_5_C5_Q1_C6=="Secretaria"
replace S6_5_C5_Q1 = 6 if S6_5_C5_Q1_C6=="secretária"

replace S6_5_C6_Q1 = 8 if S6_5_C6_Q1_C6=="rquivado"
replace S6_5_C6_Q1 = 6 if S6_5_C6_Q1_C6=="secretária"

replace S6_5_C7_Q1 = 8 if S6_5_C7_Q1_C6=="Coloca-se na varanda"
replace S6_5_C7_Q1 = 8 if S6_5_C7_Q1_C6=="Portas"
replace S6_5_C7_Q1 = 7 if S6_5_C7_Q1_C6=="Sala de aulas"
replace S6_5_C7_Q1 = 8 if S6_5_C7_Q1_C6=="Vitri a e janelas"
replace S6_5_C7_Q1 = 8 if S6_5_C7_Q1_C6=="Vitrina"
replace S6_5_C7_Q1 = 8 if S6_5_C7_Q1_C6=="Vitrina Movel"
replace S6_5_C7_Q1 = 8 if S6_5_C7_Q1_C6=="vitrina"
replace S6_5_C7_Q1 = 8 if S6_5_C7_Q1_C6=="placar"
replace S6_5_C7_Q1 = 8 if S6_5_C7_Q1_C6=="vitrina improvisada"
replace S6_5_C7_Q1 = 6 if S6_5_C7_Q1_C6=="Secretaria"
replace S6_5_C7_Q1 = 6 if S6_5_C7_Q1_C6=="frente a secretaria"
replace S6_5_C7_Q1 = 6 if S6_5_C7_Q1_C6=="secretaria"

replace S6_5_C8_Q1 = 7 if S6_5_C8_Q1_C6=="na sala de aula,com os encarregados"
replace S6_5_C8_Q1 = 6 if S6_5_C8_Q1_C6=="Secretaria"

#delimit ;
;
lab def Q6_05
1 "Director's Office"
2 "Corridor/entrance"
3 "Teachers' room"
4 "School Exterior"
5 "Non-School building nearby"
6 "Secretary"
7 "Classroom"
8 "Others: Showcase, Scoreboard, Filed"
;
lab val S6_5_C1_Q1 S6_5_C2_Q1 S6_5_C3_Q1 S6_5_C4_Q1 S6_5_C5_Q1 S6_5_C6_Q1 S6_5_C7_Q1 S6_5_C8_Q1 Q6_05
;
#delimit cr

rename S6_5_C1_Q1 Q6_05_01
rename S6_5_C2_Q1 Q6_05_02
rename S6_5_C3_Q1 Q6_05_03
rename S6_5_C4_Q1 Q6_05_04
rename S6_5_C5_Q1 Q6_05_05
rename S6_5_C6_Q1 Q6_05_06
rename S6_5_C7_Q1 Q6_05_07
rename S6_5_C8_Q1 Q6_05_08

order S6_49, after(Q6_05_08)

}
********************************************************************************
********************************** SECTION 7 ***********************************
********************************************************************************


{
*NOTE: Section 7*
*It looks like only teacher of the third and fourth classes are included.


drop S7_1_12_21_S7_3 S7_1_12_22_S7_3 S7_1_12_23_S7_3 S7_1_12_24_S7_3 S7_1_12_25_S7_3 S7_1_12_26_S7_3 S7_1_12_27_S7_3 S7_1_12_28_S7_3 S7_1_12_29_S7_3 S7_1_12_30_S7_3 S7_1_12_31_S7_3 S7_1_12_32_S7_3 S7_1_12_33_S7_3 S7_1_12_34_S7_3 S7_1_12_35_S7_3 S7_1_12_36_S7_3 S7_1_12_37_S7_3 S7_1_12_38_S7_3 S7_1_12_39_S7_3 S7_1_12_40_S7_3 S7_1_12_41_S7_3 S7_1_12_42_S7_3 S7_1_12_43_S7_3 S7_1_12_44_S7_3 S7_1_12_45_S7_3 S7_1_12_46_S7_3 S7_1_12_47_S7_3 S7_1_12_48_S7_3 S7_1_12_49_S7_3 S7_1_12_50_S7_3
drop S7_1_12_21_S7_4 S7_1_12_22_S7_4 S7_1_12_23_S7_4 S7_1_12_24_S7_4 S7_1_12_25_S7_4 S7_1_12_26_S7_4 S7_1_12_27_S7_4 S7_1_12_28_S7_4 S7_1_12_29_S7_4 S7_1_12_30_S7_4 S7_1_12_31_S7_4 S7_1_12_32_S7_4 S7_1_12_33_S7_4 S7_1_12_34_S7_4 S7_1_12_35_S7_4 S7_1_12_36_S7_4 S7_1_12_37_S7_4 S7_1_12_38_S7_4 S7_1_12_39_S7_4 S7_1_12_40_S7_4 S7_1_12_41_S7_4 S7_1_12_42_S7_4 S7_1_12_43_S7_4 S7_1_12_44_S7_4 S7_1_12_45_S7_4 S7_1_12_46_S7_4 S7_1_12_47_S7_4 S7_1_12_48_S7_4 S7_1_12_49_S7_4 S7_1_12_50_S7_4
drop S7_1_12_21_S7_6 S7_1_12_22_S7_6 S7_1_12_23_S7_6 S7_1_12_24_S7_6 S7_1_12_25_S7_6 S7_1_12_26_S7_6 S7_1_12_27_S7_6 S7_1_12_28_S7_6 S7_1_12_29_S7_6 S7_1_12_30_S7_6 S7_1_12_31_S7_6 S7_1_12_32_S7_6 S7_1_12_33_S7_6 S7_1_12_34_S7_6 S7_1_12_35_S7_6 S7_1_12_36_S7_6 S7_1_12_37_S7_6 S7_1_12_38_S7_6 S7_1_12_39_S7_6 S7_1_12_40_S7_6 S7_1_12_41_S7_6 S7_1_12_42_S7_6 S7_1_12_43_S7_6 S7_1_12_44_S7_6 S7_1_12_45_S7_6 S7_1_12_46_S7_6 S7_1_12_47_S7_6 S7_1_12_48_S7_6 S7_1_12_49_S7_6 S7_1_12_50_S7_6
drop S7_1_12_21_S7_7 S7_1_12_22_S7_7 S7_1_12_23_S7_7 S7_1_12_24_S7_7 S7_1_12_25_S7_7 S7_1_12_26_S7_7 S7_1_12_27_S7_7 S7_1_12_28_S7_7 S7_1_12_29_S7_7 S7_1_12_30_S7_7 S7_1_12_31_S7_7 S7_1_12_32_S7_7 S7_1_12_33_S7_7 S7_1_12_34_S7_7 S7_1_12_35_S7_7 S7_1_12_36_S7_7 S7_1_12_37_S7_7 S7_1_12_38_S7_7 S7_1_12_39_S7_7 S7_1_12_40_S7_7 S7_1_12_41_S7_7 S7_1_12_42_S7_7 S7_1_12_43_S7_7 S7_1_12_44_S7_7 S7_1_12_45_S7_7 S7_1_12_46_S7_7 S7_1_12_47_S7_7 S7_1_12_48_S7_7 S7_1_12_49_S7_7 S7_1_12_50_S7_7
drop S7_1_12_21_S7_7_C9 S7_1_12_22_S7_7_C9 S7_1_12_23_S7_7_C9 S7_1_12_24_S7_7_C9 S7_1_12_25_S7_7_C9 S7_1_12_26_S7_7_C9 S7_1_12_27_S7_7_C9 S7_1_12_28_S7_7_C9 S7_1_12_29_S7_7_C9 S7_1_12_30_S7_7_C9 S7_1_12_31_S7_7_C9 S7_1_12_32_S7_7_C9 S7_1_12_33_S7_7_C9 S7_1_12_34_S7_7_C9 S7_1_12_35_S7_7_C9 S7_1_12_36_S7_7_C9 S7_1_12_37_S7_7_C9 S7_1_12_38_S7_7_C9 S7_1_12_39_S7_7_C9 S7_1_12_40_S7_7_C9 S7_1_12_41_S7_7_C9 S7_1_12_42_S7_7_C9 S7_1_12_43_S7_7_C9 S7_1_12_44_S7_7_C9 S7_1_12_45_S7_7_C9 S7_1_12_46_S7_7_C9 S7_1_12_47_S7_7_C9 S7_1_12_48_S7_7_C9 S7_1_12_49_S7_7_C9 S7_1_12_50_S7_7_C9
drop S7_1_12_21_S7_7_C11 S7_1_12_22_S7_7_C11 S7_1_12_23_S7_7_C11 S7_1_12_24_S7_7_C11 S7_1_12_25_S7_7_C11 S7_1_12_26_S7_7_C11 S7_1_12_27_S7_7_C11 S7_1_12_28_S7_7_C11 S7_1_12_29_S7_7_C11 S7_1_12_30_S7_7_C11 S7_1_12_31_S7_7_C11 S7_1_12_32_S7_7_C11 S7_1_12_33_S7_7_C11 S7_1_12_34_S7_7_C11 S7_1_12_35_S7_7_C11 S7_1_12_36_S7_7_C11 S7_1_12_37_S7_7_C11 S7_1_12_38_S7_7_C11 S7_1_12_39_S7_7_C11 S7_1_12_40_S7_7_C11 S7_1_12_41_S7_7_C11 S7_1_12_42_S7_7_C11 S7_1_12_43_S7_7_C11 S7_1_12_44_S7_7_C11 S7_1_12_45_S7_7_C11 S7_1_12_46_S7_7_C11 S7_1_12_47_S7_7_C11 S7_1_12_48_S7_7_C11 S7_1_12_49_S7_7_C11 S7_1_12_50_S7_7_C11
drop S7_1_12_21_S7_7_C12 S7_1_12_22_S7_7_C12 S7_1_12_23_S7_7_C12 S7_1_12_24_S7_7_C12 S7_1_12_25_S7_7_C12 S7_1_12_26_S7_7_C12 S7_1_12_27_S7_7_C12 S7_1_12_28_S7_7_C12 S7_1_12_29_S7_7_C12 S7_1_12_30_S7_7_C12 S7_1_12_31_S7_7_C12 S7_1_12_32_S7_7_C12 S7_1_12_33_S7_7_C12 S7_1_12_34_S7_7_C12 S7_1_12_35_S7_7_C12 S7_1_12_36_S7_7_C12 S7_1_12_37_S7_7_C12 S7_1_12_38_S7_7_C12 S7_1_12_39_S7_7_C12 S7_1_12_40_S7_7_C12 S7_1_12_41_S7_7_C12 S7_1_12_42_S7_7_C12 S7_1_12_43_S7_7_C12 S7_1_12_44_S7_7_C12 S7_1_12_45_S7_7_C12 S7_1_12_46_S7_7_C12 S7_1_12_47_S7_7_C12 S7_1_12_48_S7_7_C12 S7_1_12_49_S7_7_C12 S7_1_12_50_S7_7_C12
drop S7_1_12_21_S7_8 S7_1_12_22_S7_8 S7_1_12_23_S7_8 S7_1_12_24_S7_8 S7_1_12_25_S7_8 S7_1_12_26_S7_8 S7_1_12_27_S7_8 S7_1_12_28_S7_8 S7_1_12_29_S7_8 S7_1_12_30_S7_8 S7_1_12_31_S7_8 S7_1_12_32_S7_8 S7_1_12_33_S7_8 S7_1_12_34_S7_8 S7_1_12_35_S7_8 S7_1_12_36_S7_8 S7_1_12_37_S7_8 S7_1_12_38_S7_8 S7_1_12_39_S7_8 S7_1_12_40_S7_8 S7_1_12_41_S7_8 S7_1_12_42_S7_8 S7_1_12_43_S7_8 S7_1_12_44_S7_8 S7_1_12_45_S7_8 S7_1_12_46_S7_8 S7_1_12_47_S7_8 S7_1_12_48_S7_8 S7_1_12_49_S7_8 S7_1_12_50_S7_8
drop S7_1_12_21_S7_9 S7_1_12_22_S7_9 S7_1_12_23_S7_9 S7_1_12_24_S7_9 S7_1_12_25_S7_9 S7_1_12_26_S7_9 S7_1_12_27_S7_9 S7_1_12_28_S7_9 S7_1_12_29_S7_9 S7_1_12_30_S7_9 S7_1_12_31_S7_9 S7_1_12_32_S7_9 S7_1_12_33_S7_9 S7_1_12_34_S7_9 S7_1_12_35_S7_9 S7_1_12_36_S7_9 S7_1_12_37_S7_9 S7_1_12_38_S7_9 S7_1_12_39_S7_9 S7_1_12_40_S7_9 S7_1_12_41_S7_9 S7_1_12_42_S7_9 S7_1_12_43_S7_9 S7_1_12_44_S7_9 S7_1_12_45_S7_9 S7_1_12_46_S7_9 S7_1_12_47_S7_9 S7_1_12_48_S7_9 S7_1_12_49_S7_9 S7_1_12_50_S7_9
drop S7_1_12_21_S7_10 S7_1_12_22_S7_10 S7_1_12_23_S7_10 S7_1_12_24_S7_10 S7_1_12_25_S7_10 S7_1_12_26_S7_10 S7_1_12_27_S7_10 S7_1_12_28_S7_10 S7_1_12_29_S7_10 S7_1_12_30_S7_10 S7_1_12_31_S7_10 S7_1_12_32_S7_10 S7_1_12_33_S7_10 S7_1_12_34_S7_10 S7_1_12_35_S7_10 S7_1_12_36_S7_10 S7_1_12_37_S7_10 S7_1_12_38_S7_10 S7_1_12_39_S7_10 S7_1_12_40_S7_10 S7_1_12_41_S7_10 S7_1_12_42_S7_10 S7_1_12_43_S7_10 S7_1_12_44_S7_10 S7_1_12_45_S7_10 S7_1_12_46_S7_10 S7_1_12_47_S7_10 S7_1_12_48_S7_10 S7_1_12_49_S7_10 S7_1_12_50_S7_10
drop S7_1_12_21_S7_10_Codes S7_1_12_22_S7_10_Codes S7_1_12_23_S7_10_Codes S7_1_12_24_S7_10_Codes S7_1_12_25_S7_10_Codes S7_1_12_26_S7_10_Codes S7_1_12_27_S7_10_Codes S7_1_12_28_S7_10_Codes S7_1_12_29_S7_10_Codes S7_1_12_30_S7_10_Codes S7_1_12_31_S7_10_Codes S7_1_12_32_S7_10_Codes S7_1_12_33_S7_10_Codes S7_1_12_34_S7_10_Codes S7_1_12_35_S7_10_Codes S7_1_12_36_S7_10_Codes S7_1_12_37_S7_10_Codes S7_1_12_38_S7_10_Codes S7_1_12_39_S7_10_Codes S7_1_12_40_S7_10_Codes S7_1_12_41_S7_10_Codes S7_1_12_42_S7_10_Codes S7_1_12_43_S7_10_Codes S7_1_12_44_S7_10_Codes S7_1_12_45_S7_10_Codes S7_1_12_46_S7_10_Codes S7_1_12_47_S7_10_Codes S7_1_12_48_S7_10_Codes S7_1_12_49_S7_10_Codes S7_1_12_50_S7_10_Codes
drop S7_1_12_21_S7_11 S7_1_12_22_S7_11 S7_1_12_23_S7_11 S7_1_12_24_S7_11 S7_1_12_25_S7_11 S7_1_12_26_S7_11 S7_1_12_27_S7_11 S7_1_12_28_S7_11 S7_1_12_29_S7_11 S7_1_12_30_S7_11 S7_1_12_31_S7_11 S7_1_12_32_S7_11 S7_1_12_33_S7_11 S7_1_12_34_S7_11 S7_1_12_35_S7_11 S7_1_12_36_S7_11 S7_1_12_37_S7_11 S7_1_12_38_S7_11 S7_1_12_39_S7_11 S7_1_12_40_S7_11 S7_1_12_41_S7_11 S7_1_12_42_S7_11 S7_1_12_43_S7_11 S7_1_12_44_S7_11 S7_1_12_45_S7_11 S7_1_12_46_S7_11 S7_1_12_47_S7_11 S7_1_12_48_S7_11 S7_1_12_49_S7_11 S7_1_12_50_S7_11
drop S7_1_12_21_S7_11_Codes S7_1_12_22_S7_11_Codes S7_1_12_23_S7_11_Codes S7_1_12_24_S7_11_Codes S7_1_12_25_S7_11_Codes S7_1_12_26_S7_11_Codes S7_1_12_27_S7_11_Codes S7_1_12_28_S7_11_Codes S7_1_12_29_S7_11_Codes S7_1_12_30_S7_11_Codes S7_1_12_31_S7_11_Codes S7_1_12_32_S7_11_Codes S7_1_12_33_S7_11_Codes S7_1_12_34_S7_11_Codes S7_1_12_35_S7_11_Codes S7_1_12_36_S7_11_Codes S7_1_12_37_S7_11_Codes S7_1_12_38_S7_11_Codes S7_1_12_39_S7_11_Codes S7_1_12_40_S7_11_Codes S7_1_12_41_S7_11_Codes S7_1_12_42_S7_11_Codes S7_1_12_43_S7_11_Codes S7_1_12_44_S7_11_Codes S7_1_12_45_S7_11_Codes S7_1_12_46_S7_11_Codes S7_1_12_47_S7_11_Codes S7_1_12_48_S7_11_Codes S7_1_12_49_S7_11_Codes S7_1_12_50_S7_11_Codes
drop S7_1_12_21_S7_12 S7_1_12_22_S7_12 S7_1_12_23_S7_12 S7_1_12_24_S7_12 S7_1_12_25_S7_12 S7_1_12_26_S7_12 S7_1_12_27_S7_12 S7_1_12_28_S7_12 S7_1_12_29_S7_12 S7_1_12_30_S7_12 S7_1_12_31_S7_12 S7_1_12_32_S7_12 S7_1_12_33_S7_12 S7_1_12_34_S7_12 S7_1_12_35_S7_12 S7_1_12_36_S7_12 S7_1_12_37_S7_12 S7_1_12_38_S7_12 S7_1_12_39_S7_12 S7_1_12_40_S7_12 S7_1_12_41_S7_12 S7_1_12_42_S7_12 S7_1_12_43_S7_12 S7_1_12_44_S7_12 S7_1_12_45_S7_12 S7_1_12_46_S7_12 S7_1_12_47_S7_12 S7_1_12_48_S7_12 S7_1_12_49_S7_12 S7_1_12_50_S7_12
drop S7_1_12_21_S7_12_C8 S7_1_12_22_S7_12_C8 S7_1_12_23_S7_12_C8 S7_1_12_24_S7_12_C8 S7_1_12_25_S7_12_C8 S7_1_12_26_S7_12_C8 S7_1_12_27_S7_12_C8 S7_1_12_28_S7_12_C8 S7_1_12_29_S7_12_C8 S7_1_12_30_S7_12_C8 S7_1_12_31_S7_12_C8 S7_1_12_32_S7_12_C8 S7_1_12_33_S7_12_C8 S7_1_12_34_S7_12_C8 S7_1_12_35_S7_12_C8 S7_1_12_36_S7_12_C8 S7_1_12_37_S7_12_C8 S7_1_12_38_S7_12_C8 S7_1_12_39_S7_12_C8 S7_1_12_40_S7_12_C8 S7_1_12_41_S7_12_C8 S7_1_12_42_S7_12_C8 S7_1_12_43_S7_12_C8 S7_1_12_44_S7_12_C8 S7_1_12_45_S7_12_C8 S7_1_12_46_S7_12_C8 S7_1_12_47_S7_12_C8 S7_1_12_48_S7_12_C8 S7_1_12_49_S7_12_C8 S7_1_12_50_S7_12_C8

order S7_1 S7_1_12_0_S7_3 S7_1_12_1_S7_3 S7_1_12_2_S7_3 S7_1_12_3_S7_3 S7_1_12_4_S7_3 S7_1_12_5_S7_3 S7_1_12_6_S7_3 S7_1_12_7_S7_3 S7_1_12_8_S7_3 S7_1_12_9_S7_3 S7_1_12_10_S7_3 S7_1_12_11_S7_3 S7_1_12_12_S7_3 S7_1_12_13_S7_3 S7_1_12_14_S7_3 S7_1_12_15_S7_3 S7_1_12_16_S7_3 S7_1_12_17_S7_3 S7_1_12_18_S7_3 S7_1_12_19_S7_3 S7_1_12_20_S7_3 S7_1_12_0_S7_4 S7_1_12_1_S7_4 S7_1_12_2_S7_4 S7_1_12_3_S7_4 S7_1_12_4_S7_4 S7_1_12_5_S7_4 S7_1_12_6_S7_4 S7_1_12_7_S7_4 S7_1_12_8_S7_4 S7_1_12_9_S7_4 S7_1_12_10_S7_4 S7_1_12_11_S7_4 S7_1_12_12_S7_4 S7_1_12_13_S7_4 S7_1_12_14_S7_4 S7_1_12_15_S7_4 S7_1_12_16_S7_4 S7_1_12_17_S7_4 S7_1_12_18_S7_4 S7_1_12_19_S7_4 S7_1_12_20_S7_4 S7_1_12_0_S7_6 S7_1_12_1_S7_6 S7_1_12_2_S7_6 S7_1_12_3_S7_6 S7_1_12_4_S7_6 S7_1_12_5_S7_6 S7_1_12_6_S7_6 S7_1_12_7_S7_6 S7_1_12_8_S7_6 S7_1_12_9_S7_6 S7_1_12_10_S7_6 S7_1_12_11_S7_6 S7_1_12_12_S7_6 S7_1_12_13_S7_6 S7_1_12_14_S7_6 S7_1_12_15_S7_6 S7_1_12_16_S7_6 S7_1_12_17_S7_6 S7_1_12_18_S7_6 S7_1_12_19_S7_6 S7_1_12_20_S7_6 S7_1_12_0_S7_7 S7_1_12_1_S7_7 S7_1_12_2_S7_7 S7_1_12_3_S7_7 S7_1_12_4_S7_7 S7_1_12_5_S7_7 S7_1_12_6_S7_7 S7_1_12_7_S7_7 S7_1_12_8_S7_7 S7_1_12_9_S7_7 S7_1_12_10_S7_7 S7_1_12_11_S7_7 S7_1_12_12_S7_7 S7_1_12_13_S7_7 S7_1_12_14_S7_7 S7_1_12_15_S7_7 S7_1_12_16_S7_7 S7_1_12_17_S7_7 S7_1_12_18_S7_7 S7_1_12_19_S7_7 S7_1_12_20_S7_7 S7_1_12_0_S7_7_C9 S7_1_12_1_S7_7_C9 S7_1_12_2_S7_7_C9 S7_1_12_3_S7_7_C9 S7_1_12_4_S7_7_C9 S7_1_12_5_S7_7_C9 S7_1_12_6_S7_7_C9 S7_1_12_7_S7_7_C9 S7_1_12_8_S7_7_C9 S7_1_12_9_S7_7_C9 S7_1_12_10_S7_7_C9 S7_1_12_11_S7_7_C9 S7_1_12_12_S7_7_C9 S7_1_12_13_S7_7_C9 S7_1_12_14_S7_7_C9 S7_1_12_15_S7_7_C9 S7_1_12_16_S7_7_C9 S7_1_12_17_S7_7_C9 S7_1_12_18_S7_7_C9 S7_1_12_19_S7_7_C9 S7_1_12_20_S7_7_C9 S7_1_12_0_S7_7_C11 S7_1_12_1_S7_7_C11 S7_1_12_2_S7_7_C11 S7_1_12_3_S7_7_C11 S7_1_12_4_S7_7_C11 S7_1_12_5_S7_7_C11 S7_1_12_6_S7_7_C11 S7_1_12_7_S7_7_C11 S7_1_12_8_S7_7_C11 S7_1_12_9_S7_7_C11 S7_1_12_10_S7_7_C11 S7_1_12_11_S7_7_C11 S7_1_12_12_S7_7_C11 S7_1_12_13_S7_7_C11 S7_1_12_14_S7_7_C11 S7_1_12_15_S7_7_C11 S7_1_12_16_S7_7_C11 S7_1_12_17_S7_7_C11 S7_1_12_18_S7_7_C11 S7_1_12_19_S7_7_C11 S7_1_12_20_S7_7_C11 S7_1_12_0_S7_7_C12 S7_1_12_1_S7_7_C12 S7_1_12_2_S7_7_C12 S7_1_12_3_S7_7_C12 S7_1_12_4_S7_7_C12 S7_1_12_5_S7_7_C12 S7_1_12_6_S7_7_C12 S7_1_12_7_S7_7_C12 S7_1_12_8_S7_7_C12 S7_1_12_9_S7_7_C12 S7_1_12_10_S7_7_C12 S7_1_12_11_S7_7_C12 S7_1_12_12_S7_7_C12 S7_1_12_13_S7_7_C12 S7_1_12_14_S7_7_C12 S7_1_12_15_S7_7_C12 S7_1_12_16_S7_7_C12 S7_1_12_17_S7_7_C12 S7_1_12_18_S7_7_C12 S7_1_12_19_S7_7_C12 S7_1_12_20_S7_7_C12 S7_1_12_0_S7_8 S7_1_12_1_S7_8 S7_1_12_2_S7_8 S7_1_12_3_S7_8 S7_1_12_4_S7_8 S7_1_12_5_S7_8 S7_1_12_6_S7_8 S7_1_12_7_S7_8 S7_1_12_8_S7_8 S7_1_12_9_S7_8 S7_1_12_10_S7_8 S7_1_12_11_S7_8 S7_1_12_12_S7_8 S7_1_12_13_S7_8 S7_1_12_14_S7_8 S7_1_12_15_S7_8 S7_1_12_16_S7_8 S7_1_12_17_S7_8 S7_1_12_18_S7_8 S7_1_12_19_S7_8 S7_1_12_20_S7_8 S7_1_12_0_S7_9 S7_1_12_1_S7_9 S7_1_12_2_S7_9 S7_1_12_3_S7_9 S7_1_12_4_S7_9 S7_1_12_5_S7_9 S7_1_12_6_S7_9 S7_1_12_7_S7_9 S7_1_12_8_S7_9 S7_1_12_9_S7_9 S7_1_12_10_S7_9 S7_1_12_11_S7_9 S7_1_12_12_S7_9 S7_1_12_13_S7_9 S7_1_12_14_S7_9 S7_1_12_15_S7_9 S7_1_12_16_S7_9 S7_1_12_17_S7_9 S7_1_12_18_S7_9 S7_1_12_19_S7_9 S7_1_12_20_S7_9 S7_1_12_0_S7_10 S7_1_12_1_S7_10 S7_1_12_2_S7_10 S7_1_12_3_S7_10 S7_1_12_4_S7_10 S7_1_12_5_S7_10 S7_1_12_6_S7_10 S7_1_12_7_S7_10 S7_1_12_8_S7_10 S7_1_12_9_S7_10 S7_1_12_10_S7_10 S7_1_12_11_S7_10 S7_1_12_12_S7_10 S7_1_12_13_S7_10 S7_1_12_14_S7_10 S7_1_12_15_S7_10 S7_1_12_16_S7_10 S7_1_12_17_S7_10 S7_1_12_18_S7_10 S7_1_12_19_S7_10 S7_1_12_20_S7_10 S7_1_12_0_S7_10_Codes S7_1_12_1_S7_10_Codes S7_1_12_2_S7_10_Codes S7_1_12_3_S7_10_Codes S7_1_12_4_S7_10_Codes S7_1_12_5_S7_10_Codes S7_1_12_6_S7_10_Codes S7_1_12_7_S7_10_Codes S7_1_12_8_S7_10_Codes S7_1_12_9_S7_10_Codes S7_1_12_10_S7_10_Codes S7_1_12_11_S7_10_Codes S7_1_12_12_S7_10_Codes S7_1_12_13_S7_10_Codes S7_1_12_14_S7_10_Codes S7_1_12_15_S7_10_Codes S7_1_12_16_S7_10_Codes S7_1_12_17_S7_10_Codes S7_1_12_18_S7_10_Codes S7_1_12_19_S7_10_Codes S7_1_12_20_S7_10_Codes S7_1_12_0_S7_11 S7_1_12_1_S7_11 S7_1_12_2_S7_11 S7_1_12_3_S7_11 S7_1_12_4_S7_11 S7_1_12_5_S7_11 S7_1_12_6_S7_11 S7_1_12_7_S7_11 S7_1_12_8_S7_11 S7_1_12_9_S7_11 S7_1_12_10_S7_11 S7_1_12_11_S7_11 S7_1_12_12_S7_11 S7_1_12_13_S7_11 S7_1_12_14_S7_11 S7_1_12_15_S7_11 S7_1_12_16_S7_11 S7_1_12_17_S7_11 S7_1_12_18_S7_11 S7_1_12_19_S7_11 S7_1_12_20_S7_11 S7_1_12_0_S7_11_Codes S7_1_12_1_S7_11_Codes S7_1_12_2_S7_11_Codes S7_1_12_3_S7_11_Codes S7_1_12_4_S7_11_Codes S7_1_12_5_S7_11_Codes S7_1_12_6_S7_11_Codes S7_1_12_7_S7_11_Codes S7_1_12_8_S7_11_Codes S7_1_12_9_S7_11_Codes S7_1_12_10_S7_11_Codes S7_1_12_11_S7_11_Codes S7_1_12_12_S7_11_Codes S7_1_12_13_S7_11_Codes S7_1_12_14_S7_11_Codes S7_1_12_15_S7_11_Codes S7_1_12_16_S7_11_Codes S7_1_12_17_S7_11_Codes S7_1_12_18_S7_11_Codes S7_1_12_19_S7_11_Codes S7_1_12_20_S7_11_Codes S7_1_12_0_S7_12 S7_1_12_1_S7_12 S7_1_12_2_S7_12 S7_1_12_3_S7_12 S7_1_12_4_S7_12 S7_1_12_5_S7_12 S7_1_12_6_S7_12 S7_1_12_7_S7_12 S7_1_12_8_S7_12 S7_1_12_9_S7_12 S7_1_12_10_S7_12 S7_1_12_11_S7_12 S7_1_12_12_S7_12 S7_1_12_13_S7_12 S7_1_12_14_S7_12 S7_1_12_15_S7_12 S7_1_12_16_S7_12 S7_1_12_17_S7_12 S7_1_12_18_S7_12 S7_1_12_19_S7_12 S7_1_12_20_S7_12 S7_1_12_0_S7_12_C8 S7_1_12_1_S7_12_C8 S7_1_12_2_S7_12_C8 S7_1_12_3_S7_12_C8 S7_1_12_4_S7_12_C8 S7_1_12_5_S7_12_C8 S7_1_12_6_S7_12_C8 S7_1_12_7_S7_12_C8 S7_1_12_8_S7_12_C8 S7_1_12_9_S7_12_C8 S7_1_12_10_S7_12_C8 S7_1_12_11_S7_12_C8 S7_1_12_12_S7_12_C8 S7_1_12_13_S7_12_C8 S7_1_12_14_S7_12_C8 S7_1_12_15_S7_12_C8 S7_1_12_16_S7_12_C8 S7_1_12_17_S7_12_C8 S7_1_12_18_S7_12_C8 S7_1_12_19_S7_12_C8 S7_1_12_20_S7_12_C8, after(S6_5_C8_Q1_C6)

drop S7_14_15_13_S7_14 S7_14_15_14_S7_14 S7_14_15_15_S7_14 S7_14_15_16_S7_14 S7_14_15_17_S7_14 S7_14_15_18_S7_14 S7_14_15_19_S7_14 S7_14_15_20_S7_14 S7_14_15_21_S7_14 S7_14_15_22_S7_14 S7_14_15_23_S7_14 S7_14_15_24_S7_14 S7_14_15_25_S7_14 S7_14_15_26_S7_14 S7_14_15_27_S7_14 S7_14_15_28_S7_14 S7_14_15_29_S7_14 S7_14_15_30_S7_14 S7_14_15_31_S7_14 S7_14_15_32_S7_14 S7_14_15_33_S7_14 S7_14_15_34_S7_14 S7_14_15_35_S7_14 S7_14_15_36_S7_14 S7_14_15_37_S7_14 S7_14_15_38_S7_14 S7_14_15_39_S7_14 S7_14_15_40_S7_14 S7_14_15_41_S7_14 S7_14_15_42_S7_14 S7_14_15_43_S7_14 S7_14_15_44_S7_14 S7_14_15_45_S7_14 S7_14_15_46_S7_14 S7_14_15_47_S7_14 S7_14_15_48_S7_14 S7_14_15_49_S7_14 S7_14_15_50_S7_14 S7_14_15_51_S7_14 S7_14_15_52_S7_14 S7_14_15_53_S7_14 S7_14_15_54_S7_14 S7_14_15_55_S7_14 S7_14_15_56_S7_14 S7_14_15_57_S7_14 S7_14_15_58_S7_14 S7_14_15_59_S7_14 S7_14_15_60_S7_14 S7_14_15_61_S7_14 S7_14_15_62_S7_14 S7_14_15_63_S7_14 S7_14_15_64_S7_14 S7_14_15_65_S7_14 S7_14_15_66_S7_14 S7_14_15_67_S7_14 S7_14_15_68_S7_14 S7_14_15_69_S7_14 S7_14_15_70_S7_14 S7_14_15_71_S7_14 S7_14_15_72_S7_14 S7_14_15_73_S7_14 S7_14_15_74_S7_14 S7_14_15_75_S7_14 S7_14_15_76_S7_14 S7_14_15_77_S7_14 S7_14_15_78_S7_14 S7_14_15_79_S7_14 S7_14_15_80_S7_14 S7_14_15_81_S7_14 S7_14_15_82_S7_14 S7_14_15_83_S7_14 S7_14_15_84_S7_14 S7_14_15_85_S7_14 S7_14_15_86_S7_14 S7_14_15_87_S7_14 S7_14_15_88_S7_14 S7_14_15_89_S7_14 S7_14_15_90_S7_14 S7_14_15_91_S7_14 S7_14_15_92_S7_14 S7_14_15_93_S7_14 S7_14_15_94_S7_14 S7_14_15_95_S7_14 S7_14_15_96_S7_14 S7_14_15_97_S7_14 S7_14_15_98_S7_14 S7_14_15_99_S7_14
drop S7_14_15_13_S7_14_C9 S7_14_15_14_S7_14_C9 S7_14_15_15_S7_14_C9 S7_14_15_16_S7_14_C9 S7_14_15_17_S7_14_C9 S7_14_15_18_S7_14_C9 S7_14_15_19_S7_14_C9 S7_14_15_20_S7_14_C9 S7_14_15_21_S7_14_C9 S7_14_15_22_S7_14_C9 S7_14_15_23_S7_14_C9 S7_14_15_24_S7_14_C9 S7_14_15_25_S7_14_C9 S7_14_15_26_S7_14_C9 S7_14_15_27_S7_14_C9 S7_14_15_28_S7_14_C9 S7_14_15_29_S7_14_C9 S7_14_15_30_S7_14_C9 S7_14_15_31_S7_14_C9 S7_14_15_32_S7_14_C9 S7_14_15_33_S7_14_C9 S7_14_15_34_S7_14_C9 S7_14_15_35_S7_14_C9 S7_14_15_36_S7_14_C9 S7_14_15_37_S7_14_C9 S7_14_15_38_S7_14_C9 S7_14_15_39_S7_14_C9 S7_14_15_40_S7_14_C9 S7_14_15_41_S7_14_C9 S7_14_15_42_S7_14_C9 S7_14_15_43_S7_14_C9 S7_14_15_44_S7_14_C9 S7_14_15_45_S7_14_C9 S7_14_15_46_S7_14_C9 S7_14_15_47_S7_14_C9 S7_14_15_48_S7_14_C9 S7_14_15_49_S7_14_C9 S7_14_15_50_S7_14_C9 S7_14_15_51_S7_14_C9 S7_14_15_52_S7_14_C9 S7_14_15_53_S7_14_C9 S7_14_15_54_S7_14_C9 S7_14_15_55_S7_14_C9 S7_14_15_56_S7_14_C9 S7_14_15_57_S7_14_C9 S7_14_15_58_S7_14_C9 S7_14_15_59_S7_14_C9 S7_14_15_60_S7_14_C9 S7_14_15_61_S7_14_C9 S7_14_15_62_S7_14_C9 S7_14_15_63_S7_14_C9 S7_14_15_64_S7_14_C9 S7_14_15_65_S7_14_C9 S7_14_15_66_S7_14_C9 S7_14_15_67_S7_14_C9 S7_14_15_68_S7_14_C9 S7_14_15_69_S7_14_C9 S7_14_15_70_S7_14_C9 S7_14_15_71_S7_14_C9 S7_14_15_72_S7_14_C9 S7_14_15_73_S7_14_C9 S7_14_15_74_S7_14_C9 S7_14_15_75_S7_14_C9 S7_14_15_76_S7_14_C9 S7_14_15_77_S7_14_C9 S7_14_15_78_S7_14_C9 S7_14_15_79_S7_14_C9 S7_14_15_80_S7_14_C9 S7_14_15_81_S7_14_C9 S7_14_15_82_S7_14_C9 S7_14_15_83_S7_14_C9 S7_14_15_84_S7_14_C9 S7_14_15_85_S7_14_C9 S7_14_15_86_S7_14_C9 S7_14_15_87_S7_14_C9 S7_14_15_88_S7_14_C9 S7_14_15_89_S7_14_C9 S7_14_15_90_S7_14_C9 S7_14_15_91_S7_14_C9 S7_14_15_92_S7_14_C9 S7_14_15_93_S7_14_C9 S7_14_15_94_S7_14_C9 S7_14_15_95_S7_14_C9 S7_14_15_96_S7_14_C9 S7_14_15_97_S7_14_C9 S7_14_15_98_S7_14_C9 S7_14_15_99_S7_14_C9
drop S7_14_15_13_S7_151 S7_14_15_13_S7_152 S7_14_15_13_S7_153 S7_14_15_13_S7_154 S7_14_15_13_S7_155 S7_14_15_13_S7_156 S7_14_15_14_S7_151 S7_14_15_14_S7_152 S7_14_15_14_S7_153 S7_14_15_14_S7_154 S7_14_15_14_S7_155 S7_14_15_14_S7_156 S7_14_15_15_S7_151 S7_14_15_15_S7_152 S7_14_15_15_S7_153 S7_14_15_15_S7_154 S7_14_15_15_S7_155 S7_14_15_15_S7_156 S7_14_15_16_S7_151 S7_14_15_16_S7_152 S7_14_15_16_S7_153 S7_14_15_16_S7_154 S7_14_15_16_S7_155 S7_14_15_16_S7_156 S7_14_15_17_S7_151 S7_14_15_17_S7_152 S7_14_15_17_S7_153 S7_14_15_17_S7_154 S7_14_15_17_S7_155 S7_14_15_17_S7_156 S7_14_15_18_S7_151 S7_14_15_18_S7_152 S7_14_15_18_S7_153 S7_14_15_18_S7_154 S7_14_15_18_S7_155 S7_14_15_18_S7_156 S7_14_15_19_S7_151 S7_14_15_19_S7_152 S7_14_15_19_S7_153 S7_14_15_19_S7_154 S7_14_15_19_S7_155 S7_14_15_19_S7_156 S7_14_15_20_S7_151 S7_14_15_20_S7_152 S7_14_15_20_S7_153 S7_14_15_20_S7_154 S7_14_15_20_S7_155 S7_14_15_20_S7_156 S7_14_15_21_S7_151 S7_14_15_21_S7_152 S7_14_15_21_S7_153 S7_14_15_21_S7_154 S7_14_15_21_S7_155 S7_14_15_21_S7_156 S7_14_15_22_S7_151 S7_14_15_22_S7_152 S7_14_15_22_S7_153 S7_14_15_22_S7_154 S7_14_15_22_S7_155 S7_14_15_22_S7_156 S7_14_15_23_S7_151 S7_14_15_23_S7_152 S7_14_15_23_S7_153 S7_14_15_23_S7_154 S7_14_15_23_S7_155 S7_14_15_23_S7_156 S7_14_15_24_S7_151 S7_14_15_24_S7_152 S7_14_15_24_S7_153 S7_14_15_24_S7_154 S7_14_15_24_S7_155 S7_14_15_24_S7_156 S7_14_15_25_S7_151 S7_14_15_25_S7_152 S7_14_15_25_S7_153 S7_14_15_25_S7_154 S7_14_15_25_S7_155 S7_14_15_25_S7_156 S7_14_15_26_S7_151 S7_14_15_26_S7_152 S7_14_15_26_S7_153 S7_14_15_26_S7_154 S7_14_15_26_S7_155 S7_14_15_26_S7_156 S7_14_15_27_S7_151 S7_14_15_27_S7_152 S7_14_15_27_S7_153 S7_14_15_27_S7_154 S7_14_15_27_S7_155 S7_14_15_27_S7_156 S7_14_15_28_S7_151 S7_14_15_28_S7_152 S7_14_15_28_S7_153 S7_14_15_28_S7_154 S7_14_15_28_S7_155 S7_14_15_28_S7_156 S7_14_15_29_S7_151 S7_14_15_29_S7_152 S7_14_15_29_S7_153 S7_14_15_29_S7_154 S7_14_15_29_S7_155 S7_14_15_29_S7_156 S7_14_15_30_S7_151 S7_14_15_30_S7_152 S7_14_15_30_S7_153 S7_14_15_30_S7_154 S7_14_15_30_S7_155 S7_14_15_30_S7_156 S7_14_15_31_S7_151 S7_14_15_31_S7_152 S7_14_15_31_S7_153 S7_14_15_31_S7_154 S7_14_15_31_S7_155 S7_14_15_31_S7_156 S7_14_15_32_S7_151 S7_14_15_32_S7_152 S7_14_15_32_S7_153 S7_14_15_32_S7_154 S7_14_15_32_S7_155 S7_14_15_32_S7_156 S7_14_15_33_S7_151 S7_14_15_33_S7_152 S7_14_15_33_S7_153 S7_14_15_33_S7_154 S7_14_15_33_S7_155 S7_14_15_33_S7_156 S7_14_15_34_S7_151 S7_14_15_34_S7_152 S7_14_15_34_S7_153 S7_14_15_34_S7_154 S7_14_15_34_S7_155 S7_14_15_34_S7_156 S7_14_15_35_S7_151 S7_14_15_35_S7_152 S7_14_15_35_S7_153 S7_14_15_35_S7_154 S7_14_15_35_S7_155 S7_14_15_35_S7_156 S7_14_15_36_S7_151 S7_14_15_36_S7_152 S7_14_15_36_S7_153 S7_14_15_36_S7_154 S7_14_15_36_S7_155 S7_14_15_36_S7_156 S7_14_15_37_S7_151 S7_14_15_37_S7_152 S7_14_15_37_S7_153 S7_14_15_37_S7_154 S7_14_15_37_S7_155 S7_14_15_37_S7_156 S7_14_15_38_S7_151 S7_14_15_38_S7_152 S7_14_15_38_S7_153 S7_14_15_38_S7_154 S7_14_15_38_S7_155 S7_14_15_38_S7_156 S7_14_15_39_S7_151 S7_14_15_39_S7_152 S7_14_15_39_S7_153 S7_14_15_39_S7_154 S7_14_15_39_S7_155 S7_14_15_39_S7_156 S7_14_15_40_S7_151 S7_14_15_40_S7_152 S7_14_15_40_S7_153 S7_14_15_40_S7_154 S7_14_15_40_S7_155 S7_14_15_40_S7_156 S7_14_15_41_S7_151 S7_14_15_41_S7_152 S7_14_15_41_S7_153 S7_14_15_41_S7_154 S7_14_15_41_S7_155 S7_14_15_41_S7_156 S7_14_15_42_S7_151 S7_14_15_42_S7_152 S7_14_15_42_S7_153 S7_14_15_42_S7_154 S7_14_15_42_S7_155 S7_14_15_42_S7_156 S7_14_15_43_S7_151 S7_14_15_43_S7_152 S7_14_15_43_S7_153 S7_14_15_43_S7_154 S7_14_15_43_S7_155 S7_14_15_43_S7_156 S7_14_15_44_S7_151 S7_14_15_44_S7_152 S7_14_15_44_S7_153 S7_14_15_44_S7_154 S7_14_15_44_S7_155 S7_14_15_44_S7_156 S7_14_15_45_S7_151 S7_14_15_45_S7_152 S7_14_15_45_S7_153 S7_14_15_45_S7_154 S7_14_15_45_S7_155 S7_14_15_45_S7_156 S7_14_15_46_S7_151 S7_14_15_46_S7_152 S7_14_15_46_S7_153 S7_14_15_46_S7_154 S7_14_15_46_S7_155 S7_14_15_46_S7_156 S7_14_15_47_S7_151 S7_14_15_47_S7_152 S7_14_15_47_S7_153 S7_14_15_47_S7_154 S7_14_15_47_S7_155 S7_14_15_47_S7_156 S7_14_15_48_S7_151 S7_14_15_48_S7_152 S7_14_15_48_S7_153 S7_14_15_48_S7_154 S7_14_15_48_S7_155 S7_14_15_48_S7_156 S7_14_15_49_S7_151 S7_14_15_49_S7_152 S7_14_15_49_S7_153 S7_14_15_49_S7_154 S7_14_15_49_S7_155 S7_14_15_49_S7_156 S7_14_15_50_S7_151 S7_14_15_50_S7_152 S7_14_15_50_S7_153 S7_14_15_50_S7_154 S7_14_15_50_S7_155 S7_14_15_50_S7_156 S7_14_15_51_S7_151 S7_14_15_51_S7_152 S7_14_15_51_S7_153 S7_14_15_51_S7_154 S7_14_15_51_S7_155 S7_14_15_51_S7_156 S7_14_15_52_S7_151 S7_14_15_52_S7_152 S7_14_15_52_S7_153 S7_14_15_52_S7_154 S7_14_15_52_S7_155 S7_14_15_52_S7_156 S7_14_15_53_S7_151 S7_14_15_53_S7_152 S7_14_15_53_S7_153 S7_14_15_53_S7_154 S7_14_15_53_S7_155 S7_14_15_53_S7_156 S7_14_15_54_S7_151 S7_14_15_54_S7_152 S7_14_15_54_S7_153 S7_14_15_54_S7_154 S7_14_15_54_S7_155 S7_14_15_54_S7_156 S7_14_15_55_S7_151 S7_14_15_55_S7_152 S7_14_15_55_S7_153 S7_14_15_55_S7_154 S7_14_15_55_S7_155 S7_14_15_55_S7_156 S7_14_15_56_S7_151 S7_14_15_56_S7_152 S7_14_15_56_S7_153 S7_14_15_56_S7_154 S7_14_15_56_S7_155 S7_14_15_56_S7_156 S7_14_15_57_S7_151 S7_14_15_57_S7_152 S7_14_15_57_S7_153 S7_14_15_57_S7_154 S7_14_15_57_S7_155 S7_14_15_57_S7_156 S7_14_15_58_S7_151 S7_14_15_58_S7_152 S7_14_15_58_S7_153 S7_14_15_58_S7_154 S7_14_15_58_S7_155 S7_14_15_58_S7_156 S7_14_15_59_S7_151 S7_14_15_59_S7_152 S7_14_15_59_S7_153 S7_14_15_59_S7_154 S7_14_15_59_S7_155 S7_14_15_59_S7_156 S7_14_15_60_S7_151 S7_14_15_60_S7_152 S7_14_15_60_S7_153 S7_14_15_60_S7_154 S7_14_15_60_S7_155 S7_14_15_60_S7_156 S7_14_15_61_S7_151 S7_14_15_61_S7_152 S7_14_15_61_S7_153 S7_14_15_61_S7_154 S7_14_15_61_S7_155 S7_14_15_61_S7_156 S7_14_15_62_S7_151 S7_14_15_62_S7_152 S7_14_15_62_S7_153 S7_14_15_62_S7_154 S7_14_15_62_S7_155 S7_14_15_62_S7_156 S7_14_15_63_S7_151 S7_14_15_63_S7_152 S7_14_15_63_S7_153 S7_14_15_63_S7_154 S7_14_15_63_S7_155 S7_14_15_63_S7_156 S7_14_15_64_S7_151 S7_14_15_64_S7_152 S7_14_15_64_S7_153 S7_14_15_64_S7_154 S7_14_15_64_S7_155 S7_14_15_64_S7_156 S7_14_15_65_S7_151 S7_14_15_65_S7_152 S7_14_15_65_S7_153 S7_14_15_65_S7_154 S7_14_15_65_S7_155 S7_14_15_65_S7_156 S7_14_15_66_S7_151 S7_14_15_66_S7_152 S7_14_15_66_S7_153 S7_14_15_66_S7_154 S7_14_15_66_S7_155 S7_14_15_66_S7_156 S7_14_15_67_S7_151 S7_14_15_67_S7_152 S7_14_15_67_S7_153 S7_14_15_67_S7_154 S7_14_15_67_S7_155 S7_14_15_67_S7_156 S7_14_15_68_S7_151 S7_14_15_68_S7_152 S7_14_15_68_S7_153 S7_14_15_68_S7_154 S7_14_15_68_S7_155 S7_14_15_68_S7_156 S7_14_15_69_S7_151 S7_14_15_69_S7_152 S7_14_15_69_S7_153 S7_14_15_69_S7_154 S7_14_15_69_S7_155 S7_14_15_69_S7_156 S7_14_15_70_S7_151 S7_14_15_70_S7_152 S7_14_15_70_S7_153 S7_14_15_70_S7_154 S7_14_15_70_S7_155 S7_14_15_70_S7_156 S7_14_15_71_S7_151 S7_14_15_71_S7_152 S7_14_15_71_S7_153 S7_14_15_71_S7_154 S7_14_15_71_S7_155 S7_14_15_71_S7_156 S7_14_15_72_S7_151 S7_14_15_72_S7_152 S7_14_15_72_S7_153 S7_14_15_72_S7_154 S7_14_15_72_S7_155 S7_14_15_72_S7_156 S7_14_15_73_S7_151 S7_14_15_73_S7_152 S7_14_15_73_S7_153 S7_14_15_73_S7_154 S7_14_15_73_S7_155 S7_14_15_73_S7_156 S7_14_15_74_S7_151 S7_14_15_74_S7_152 S7_14_15_74_S7_153 S7_14_15_74_S7_154 S7_14_15_74_S7_155 S7_14_15_74_S7_156 S7_14_15_75_S7_151 S7_14_15_75_S7_152 S7_14_15_75_S7_153 S7_14_15_75_S7_154 S7_14_15_75_S7_155 S7_14_15_75_S7_156 S7_14_15_76_S7_151 S7_14_15_76_S7_152 S7_14_15_76_S7_153 S7_14_15_76_S7_154 S7_14_15_76_S7_155 S7_14_15_76_S7_156 S7_14_15_77_S7_151 S7_14_15_77_S7_152 S7_14_15_77_S7_153 S7_14_15_77_S7_154 S7_14_15_77_S7_155 S7_14_15_77_S7_156 S7_14_15_78_S7_151 S7_14_15_78_S7_152 S7_14_15_78_S7_153 S7_14_15_78_S7_154 S7_14_15_78_S7_155 S7_14_15_78_S7_156 S7_14_15_79_S7_151 S7_14_15_79_S7_152 S7_14_15_79_S7_153 S7_14_15_79_S7_154 S7_14_15_79_S7_155 S7_14_15_79_S7_156 S7_14_15_80_S7_151 S7_14_15_80_S7_152 S7_14_15_80_S7_153 S7_14_15_80_S7_154 S7_14_15_80_S7_155 S7_14_15_80_S7_156 S7_14_15_81_S7_151 S7_14_15_81_S7_152 S7_14_15_81_S7_153 S7_14_15_81_S7_154 S7_14_15_81_S7_155 S7_14_15_81_S7_156 S7_14_15_82_S7_151 S7_14_15_82_S7_152 S7_14_15_82_S7_153 S7_14_15_82_S7_154 S7_14_15_82_S7_155 S7_14_15_82_S7_156 S7_14_15_83_S7_151 S7_14_15_83_S7_152 S7_14_15_83_S7_153 S7_14_15_83_S7_154 S7_14_15_83_S7_155 S7_14_15_83_S7_156 S7_14_15_84_S7_151 S7_14_15_84_S7_152 S7_14_15_84_S7_153 S7_14_15_84_S7_154 S7_14_15_84_S7_155 S7_14_15_84_S7_156 S7_14_15_85_S7_151 S7_14_15_85_S7_152 S7_14_15_85_S7_153 S7_14_15_85_S7_154 S7_14_15_85_S7_155 S7_14_15_85_S7_156 S7_14_15_86_S7_151 S7_14_15_86_S7_152 S7_14_15_86_S7_153 S7_14_15_86_S7_154 S7_14_15_86_S7_155 S7_14_15_86_S7_156 S7_14_15_87_S7_151 S7_14_15_87_S7_152 S7_14_15_87_S7_153 S7_14_15_87_S7_154 S7_14_15_87_S7_155 S7_14_15_87_S7_156 S7_14_15_88_S7_151 S7_14_15_88_S7_152 S7_14_15_88_S7_153 S7_14_15_88_S7_154 S7_14_15_88_S7_155 S7_14_15_88_S7_156 S7_14_15_89_S7_151 S7_14_15_89_S7_152 S7_14_15_89_S7_153 S7_14_15_89_S7_154 S7_14_15_89_S7_155 S7_14_15_89_S7_156 S7_14_15_90_S7_151 S7_14_15_90_S7_152 S7_14_15_90_S7_153 S7_14_15_90_S7_154 S7_14_15_90_S7_155 S7_14_15_90_S7_156 S7_14_15_91_S7_151 S7_14_15_91_S7_152 S7_14_15_91_S7_153 S7_14_15_91_S7_154 S7_14_15_91_S7_155 S7_14_15_91_S7_156 S7_14_15_92_S7_151 S7_14_15_92_S7_152 S7_14_15_92_S7_153 S7_14_15_92_S7_154 S7_14_15_92_S7_155 S7_14_15_92_S7_156 S7_14_15_93_S7_151 S7_14_15_93_S7_152 S7_14_15_93_S7_153 S7_14_15_93_S7_154 S7_14_15_93_S7_155 S7_14_15_93_S7_156 S7_14_15_94_S7_151 S7_14_15_94_S7_152 S7_14_15_94_S7_153 S7_14_15_94_S7_154 S7_14_15_94_S7_155 S7_14_15_94_S7_156 S7_14_15_95_S7_151 S7_14_15_95_S7_152 S7_14_15_95_S7_153 S7_14_15_95_S7_154 S7_14_15_95_S7_155 S7_14_15_95_S7_156 S7_14_15_96_S7_151 S7_14_15_96_S7_152 S7_14_15_96_S7_153 S7_14_15_96_S7_154 S7_14_15_96_S7_155 S7_14_15_96_S7_156 S7_14_15_97_S7_151 S7_14_15_97_S7_152 S7_14_15_97_S7_153 S7_14_15_97_S7_154 S7_14_15_97_S7_155 S7_14_15_97_S7_156 S7_14_15_98_S7_151 S7_14_15_98_S7_152 S7_14_15_98_S7_153 S7_14_15_98_S7_154 S7_14_15_98_S7_155 S7_14_15_98_S7_156 S7_14_15_99_S7_151 S7_14_15_99_S7_152 S7_14_15_99_S7_153 S7_14_15_99_S7_154 S7_14_15_99_S7_155 S7_14_15_99_S7_156
drop S7_14_15_13_S7_15_C6 S7_14_15_14_S7_15_C6 S7_14_15_15_S7_15_C6 S7_14_15_16_S7_15_C6 S7_14_15_17_S7_15_C6 S7_14_15_18_S7_15_C6 S7_14_15_19_S7_15_C6 S7_14_15_20_S7_15_C6 S7_14_15_21_S7_15_C6 S7_14_15_22_S7_15_C6 S7_14_15_23_S7_15_C6 S7_14_15_24_S7_15_C6 S7_14_15_25_S7_15_C6 S7_14_15_26_S7_15_C6 S7_14_15_27_S7_15_C6 S7_14_15_28_S7_15_C6 S7_14_15_29_S7_15_C6 S7_14_15_30_S7_15_C6 S7_14_15_31_S7_15_C6 S7_14_15_32_S7_15_C6 S7_14_15_33_S7_15_C6 S7_14_15_34_S7_15_C6 S7_14_15_35_S7_15_C6 S7_14_15_36_S7_15_C6 S7_14_15_37_S7_15_C6 S7_14_15_38_S7_15_C6 S7_14_15_39_S7_15_C6 S7_14_15_40_S7_15_C6 S7_14_15_41_S7_15_C6 S7_14_15_42_S7_15_C6 S7_14_15_43_S7_15_C6 S7_14_15_44_S7_15_C6 S7_14_15_45_S7_15_C6 S7_14_15_46_S7_15_C6 S7_14_15_47_S7_15_C6 S7_14_15_48_S7_15_C6 S7_14_15_49_S7_15_C6 S7_14_15_50_S7_15_C6 S7_14_15_51_S7_15_C6 S7_14_15_52_S7_15_C6 S7_14_15_53_S7_15_C6 S7_14_15_54_S7_15_C6 S7_14_15_55_S7_15_C6 S7_14_15_56_S7_15_C6 S7_14_15_57_S7_15_C6 S7_14_15_58_S7_15_C6 S7_14_15_59_S7_15_C6 S7_14_15_60_S7_15_C6 S7_14_15_61_S7_15_C6 S7_14_15_62_S7_15_C6 S7_14_15_63_S7_15_C6 S7_14_15_64_S7_15_C6 S7_14_15_65_S7_15_C6 S7_14_15_66_S7_15_C6 S7_14_15_67_S7_15_C6 S7_14_15_68_S7_15_C6 S7_14_15_69_S7_15_C6 S7_14_15_70_S7_15_C6 S7_14_15_71_S7_15_C6 S7_14_15_72_S7_15_C6 S7_14_15_73_S7_15_C6 S7_14_15_74_S7_15_C6 S7_14_15_75_S7_15_C6 S7_14_15_76_S7_15_C6 S7_14_15_77_S7_15_C6 S7_14_15_78_S7_15_C6 S7_14_15_79_S7_15_C6 S7_14_15_80_S7_15_C6 S7_14_15_81_S7_15_C6 S7_14_15_82_S7_15_C6 S7_14_15_83_S7_15_C6 S7_14_15_84_S7_15_C6 S7_14_15_85_S7_15_C6 S7_14_15_86_S7_15_C6 S7_14_15_87_S7_15_C6 S7_14_15_88_S7_15_C6 S7_14_15_89_S7_15_C6 S7_14_15_90_S7_15_C6 S7_14_15_91_S7_15_C6 S7_14_15_92_S7_15_C6 S7_14_15_93_S7_15_C6 S7_14_15_94_S7_15_C6 S7_14_15_95_S7_15_C6 S7_14_15_96_S7_15_C6 S7_14_15_97_S7_15_C6 S7_14_15_98_S7_15_C6 S7_14_15_99_S7_15_C6

lab var S7_1 "How many 3rd and 4th grade teachers are currently at the school"

rename S7_1 Q7_01

lab var S7_1_12_0_S7_3 "Name of teacher 1"
lab var S7_1_12_1_S7_3 "Name of teacher 2"
lab var S7_1_12_2_S7_3 "Name of teacher 3"
lab var S7_1_12_3_S7_3 "Name of teacher 4"
lab var S7_1_12_4_S7_3 "Name of teacher 5"
lab var S7_1_12_5_S7_3  "Name of teacher 6"
lab var S7_1_12_6_S7_3 "Name of teacher 7"
lab var S7_1_12_7_S7_3 "Name of teacher 8"
lab var S7_1_12_8_S7_3 "Name of teacher 9"
lab var S7_1_12_9_S7_3 "Name of teacher 10"
lab var S7_1_12_10_S7_3 "Name of teacher 11"
lab var S7_1_12_11_S7_3 "Name of teacher 12"
lab var S7_1_12_12_S7_3 "Name of teacher 13"
lab var S7_1_12_13_S7_3 "Name of teacher 14"
lab var S7_1_12_14_S7_3 "Name of teacher 15"
lab var S7_1_12_15_S7_3 "Name of teacher 16"
lab var S7_1_12_16_S7_3 "Name of teacher 17"
lab var S7_1_12_17_S7_3 "Name of teacher 18"
lab var S7_1_12_18_S7_3 "Name of teacher 19"
lab var S7_1_12_19_S7_3 "Name of teacher 20"
lab var S7_1_12_20_S7_3 "Name of teacher 21"

rename S7_1_12_0_S7_3 Q7_03_01
rename S7_1_12_1_S7_3 Q7_03_02
rename S7_1_12_2_S7_3 Q7_03_03
rename S7_1_12_3_S7_3 Q7_03_04
rename S7_1_12_4_S7_3 Q7_03_05
rename S7_1_12_5_S7_3 Q7_03_06
rename S7_1_12_6_S7_3 Q7_03_07
rename S7_1_12_7_S7_3 Q7_03_08
rename S7_1_12_8_S7_3 Q7_03_09
rename S7_1_12_9_S7_3 Q7_03_10
rename S7_1_12_10_S7_3 Q7_03_11
rename S7_1_12_11_S7_3 Q7_03_12
rename S7_1_12_12_S7_3 Q7_03_13
rename S7_1_12_13_S7_3 Q7_03_14
rename S7_1_12_14_S7_3 Q7_03_15
rename S7_1_12_15_S7_3 Q7_03_16
rename S7_1_12_16_S7_3 Q7_03_17
rename S7_1_12_17_S7_3 Q7_03_18
rename S7_1_12_18_S7_3 Q7_03_19
rename S7_1_12_19_S7_3 Q7_03_20
rename S7_1_12_20_S7_3 Q7_03_21


lab var S7_1_12_0_S7_4 "(1) Teacher was interviewed individually"
lab var S7_1_12_1_S7_4 "(2) Teacher was interviewed individually"
lab var S7_1_12_2_S7_4 "(3) Teacher was interviewed individually"
lab var S7_1_12_3_S7_4 "(4) Teacher was interviewed individually"
lab var S7_1_12_4_S7_4 "(5) Teacher was interviewed individually"
lab var S7_1_12_5_S7_4 "(6) Teacher was interviewed individually"
lab var S7_1_12_6_S7_4 "(7) Teacher was interviewed individually"
lab var S7_1_12_7_S7_4 "(8) Teacher was interviewed individually"
lab var S7_1_12_8_S7_4 "(9) Teacher was interviewed individually"
lab var S7_1_12_9_S7_4 "(10) Teacher was interviewed individually"
lab var S7_1_12_10_S7_4 "(11) Teacher was interviewed individually"
lab var S7_1_12_11_S7_4 "(12) Teacher was interviewed individually"
lab var S7_1_12_12_S7_4 "(13) Teacher was interviewed individually"
lab var S7_1_12_13_S7_4 "(14) Teacher was interviewed individually"
lab var S7_1_12_14_S7_4 "(15) Teacher was interviewed individually"
lab var S7_1_12_15_S7_4 "(16) Teacher was interviewed individually"
lab var S7_1_12_16_S7_4 "(17) Teacher was interviewed individually"
lab var S7_1_12_17_S7_4 "(18) Teacher was interviewed individually"
lab var S7_1_12_18_S7_4 "(19) Teacher was interviewed individually"
lab var S7_1_12_19_S7_4 "(20) Teacher was interviewed individually"
lab var S7_1_12_20_S7_4 "(21) Teacher was interviewed individually"

foreach var in S7_1_12_0_S7_4 S7_1_12_1_S7_4 S7_1_12_2_S7_4 S7_1_12_3_S7_4 S7_1_12_4_S7_4 S7_1_12_5_S7_4 S7_1_12_6_S7_4 S7_1_12_7_S7_4 S7_1_12_8_S7_4 S7_1_12_9_S7_4 S7_1_12_10_S7_4 S7_1_12_11_S7_4 S7_1_12_12_S7_4 S7_1_12_13_S7_4 S7_1_12_14_S7_4 S7_1_12_15_S7_4 S7_1_12_16_S7_4 S7_1_12_17_S7_4 S7_1_12_18_S7_4 S7_1_12_19_S7_4 S7_1_12_20_S7_4{
replace `var' = 0 if `var'==2
}

lab val S7_1_12_0_S7_4 S7_1_12_1_S7_4 S7_1_12_2_S7_4 S7_1_12_3_S7_4 S7_1_12_4_S7_4 S7_1_12_5_S7_4 S7_1_12_6_S7_4 S7_1_12_7_S7_4 S7_1_12_8_S7_4 S7_1_12_9_S7_4 S7_1_12_10_S7_4 S7_1_12_11_S7_4 S7_1_12_12_S7_4 S7_1_12_13_S7_4 S7_1_12_14_S7_4 S7_1_12_15_S7_4 S7_1_12_16_S7_4 S7_1_12_17_S7_4 S7_1_12_18_S7_4 S7_1_12_19_S7_4 S7_1_12_20_S7_4 dummy

rename S7_1_12_0_S7_4 Q7_04_01
rename S7_1_12_1_S7_4 Q7_04_02
rename S7_1_12_2_S7_4 Q7_04_03
rename S7_1_12_3_S7_4 Q7_04_04
rename S7_1_12_4_S7_4 Q7_04_05
rename S7_1_12_5_S7_4 Q7_04_06
rename S7_1_12_6_S7_4 Q7_04_07
rename S7_1_12_7_S7_4 Q7_04_08
rename S7_1_12_8_S7_4 Q7_04_09
rename S7_1_12_9_S7_4 Q7_04_10
rename S7_1_12_10_S7_4 Q7_04_11
rename S7_1_12_11_S7_4 Q7_04_12
rename S7_1_12_12_S7_4 Q7_04_13
rename S7_1_12_13_S7_4 Q7_04_14
rename S7_1_12_14_S7_4 Q7_04_15
rename S7_1_12_15_S7_4 Q7_04_16
rename S7_1_12_16_S7_4 Q7_04_17
rename S7_1_12_17_S7_4 Q7_04_18
rename S7_1_12_18_S7_4 Q7_04_19
rename S7_1_12_19_S7_4 Q7_04_20
rename S7_1_12_20_S7_4 Q7_04_21

replace S7_1_12_0_S7_6="" if S7_1_12_0_S7_6=="joana"

foreach var in S7_1_12_0_S7_6 S7_1_12_1_S7_6 S7_1_12_2_S7_6 S7_1_12_3_S7_6 S7_1_12_4_S7_6 S7_1_12_5_S7_6 S7_1_12_6_S7_6 S7_1_12_7_S7_6 S7_1_12_8_S7_6 S7_1_12_9_S7_6 S7_1_12_10_S7_6 S7_1_12_11_S7_6 S7_1_12_12_S7_6 S7_1_12_13_S7_6 S7_1_12_14_S7_6 S7_1_12_15_S7_6 S7_1_12_16_S7_6 S7_1_12_17_S7_6 S7_1_12_18_S7_6 S7_1_12_19_S7_6 S7_1_12_20_S7_6{
replace `var' = "3" if inlist(`var',"3 CLASSE","3 Cclasse","3 Classe","3 classe","3ª","3ª Classe","3ª classe")
replace `var' = "3" if inlist(`var',"3ª classse","3ªa classe","3ª calsse")
replace `var' = "4" if inlist(`var',"4ª","4 Classe","4 classe","4ª","4ª classe","4ª Classe","4º Classe","4 CLASSE","modulo 2/4 classe")
destring `var', replace
replace `var'=. if `var'==0
}

lab var S7_1_12_0_S7_6 "(1) Class taught by professor"
lab var S7_1_12_1_S7_6 "(2) Class taught by professor"
lab var S7_1_12_2_S7_6 "(3) Class taught by professor"
lab var S7_1_12_3_S7_6 "(4) Class taught by professor"
lab var S7_1_12_4_S7_6 "(5) Class taught by professor"
lab var S7_1_12_5_S7_6 "(6) Class taught by professor"
lab var S7_1_12_6_S7_6 "(7) Class taught by professor"
lab var S7_1_12_7_S7_6 "(8) Class taught by professor"
lab var S7_1_12_8_S7_6 "(9) Class taught by professor"
lab var S7_1_12_9_S7_6 "(10) Class taught by professor"
lab var S7_1_12_10_S7_6 "(11) Class taught by professor"
lab var S7_1_12_11_S7_6 "(12) Class taught by professor"
lab var S7_1_12_12_S7_6 "(13) Class taught by professor"
lab var S7_1_12_13_S7_6 "(14) Class taught by professor"
lab var S7_1_12_14_S7_6 "(15) Class taught by professor"
lab var S7_1_12_15_S7_6 "(16) Class taught by professor"
lab var S7_1_12_16_S7_6 "(17) Class taught by professor"
lab var S7_1_12_17_S7_6 "(18) Class taught by professor"
lab var S7_1_12_18_S7_6 "(19) Class taught by professor"
lab var S7_1_12_19_S7_6 "(20) Class taught by professor"
lab var S7_1_12_20_S7_6 "(21) Class taught by professor"

rename S7_1_12_0_S7_6 Q7_06_01
rename S7_1_12_1_S7_6 Q7_06_02
rename S7_1_12_2_S7_6 Q7_06_03
rename S7_1_12_3_S7_6 Q7_06_04
rename S7_1_12_4_S7_6 Q7_06_05
rename S7_1_12_5_S7_6 Q7_06_06
rename S7_1_12_6_S7_6 Q7_06_07
rename S7_1_12_7_S7_6 Q7_06_08
rename S7_1_12_8_S7_6 Q7_06_09
rename S7_1_12_9_S7_6 Q7_06_10
rename S7_1_12_10_S7_6 Q7_06_11
rename S7_1_12_11_S7_6 Q7_06_12
rename S7_1_12_12_S7_6 Q7_06_13
rename S7_1_12_13_S7_6 Q7_06_14
rename S7_1_12_14_S7_6 Q7_06_15
rename S7_1_12_15_S7_6 Q7_06_16
rename S7_1_12_16_S7_6 Q7_06_17
rename S7_1_12_17_S7_6 Q7_06_18
rename S7_1_12_18_S7_6 Q7_06_19
rename S7_1_12_19_S7_6 Q7_06_20
rename S7_1_12_20_S7_6 Q7_06_21

replace S7_1_12_1_S7_7=8 if S7_1_12_1_S7_7_C9=="bacharel"

foreach var in S7_1_12_0_S7_7 S7_1_12_1_S7_7 S7_1_12_2_S7_7 S7_1_12_3_S7_7 S7_1_12_4_S7_7 S7_1_12_5_S7_7 S7_1_12_6_S7_7 S7_1_12_7_S7_7 S7_1_12_8_S7_7 S7_1_12_9_S7_7 S7_1_12_10_S7_7 S7_1_12_11_S7_7 S7_1_12_12_S7_7 S7_1_12_13_S7_7 S7_1_12_14_S7_7 S7_1_12_15_S7_7 S7_1_12_16_S7_7 S7_1_12_17_S7_7 S7_1_12_18_S7_7 S7_1_12_19_S7_7 S7_1_12_20_S7_7{
replace `var' = . if `var'==12
}

replace S7_1_12_0_S7_7 = 12 if S7_1_12_0_S7_7_C12=="2 ano isced"
replace S7_1_12_0_S7_7 = 12 if S7_1_12_0_S7_7_C12=="2 isced"
replace S7_1_12_0_S7_7 = 7 if S7_1_12_0_S7_7_C12=="3º ano bacharel"
replace S7_1_12_0_S7_7 = 7 if S7_1_12_0_S7_7_C12=="Licenciado"
replace S7_1_12_0_S7_7 = 7 if S7_1_12_0_S7_7_C12=="licenciada"
replace S7_1_12_1_S7_7 = 11 if S7_1_12_1_S7_7_C12=="1 isced"
replace S7_1_12_1_S7_7 = . if S7_1_12_1_S7_7_C12=="13"
replace S7_1_12_1_S7_7 = 11 if S7_1_12_1_S7_7_C12=="1isced"
replace S7_1_12_1_S7_7 = 12 if S7_1_12_1_S7_7_C12=="2 ani isced"
replace S7_1_12_1_S7_7 = 12 if S7_1_12_1_S7_7_C12=="2isced"
replace S7_1_12_2_S7_7 = 1 if S7_1_12_2_S7_7_C12=="1isced"
replace S7_1_12_2_S7_7 = 12 if S7_1_12_2_S7_7_C12=="2isced"
replace S7_1_12_2_S7_7 = . if S7_1_12_2_S7_7_C12=="Não Sabe"
replace S7_1_12_3_S7_7 = 7 if S7_1_12_3_S7_7_C12=="3isced"
replace S7_1_12_5_S7_7 = 7 if S7_1_12_5_S7_7_C12=="bacharel no Isp"
replace S7_1_12_5_S7_7 = 7 if S7_1_12_5_S7_7_C12=="licenciada isced"
replace S7_1_12_8_S7_7 = 11 if S7_1_12_8_S7_7_C12=="1isced"
replace S7_1_12_10_S7_7 = 12 if S7_1_12_10_S7_7_C12=="2isced"
replace S7_1_12_13_S7_7 = 12 if S7_1_12_13_S7_7_C12=="2isced"


foreach var in S7_1_12_0_S7_7 S7_1_12_1_S7_7 S7_1_12_2_S7_7 S7_1_12_3_S7_7 S7_1_12_4_S7_7 S7_1_12_5_S7_7 S7_1_12_6_S7_7 S7_1_12_7_S7_7 S7_1_12_8_S7_7 S7_1_12_9_S7_7 S7_1_12_10_S7_7 S7_1_12_11_S7_7 S7_1_12_12_S7_7 S7_1_12_13_S7_7 S7_1_12_14_S7_7 S7_1_12_15_S7_7 S7_1_12_16_S7_7 S7_1_12_17_S7_7 S7_1_12_18_S7_7 S7_1_12_19_S7_7 S7_1_12_20_S7_7{
recode `var' (12=8) (11=7) (10=12) (9=11) (8=10) (7=9)
}

#delimit ;
;
lab def edu2
1 "First level (former primary school)."
2 "Second level (old high school, 5th and 6th grade)."
3 "Third level (former preparatory school, 7th and 8th grades)."
4 "High school (9th to 12th grade)."
5 "Professional technical education (2-4 years)."
6 "Pedagogical secondary school."
7 "University - 1 year of education studies."
8 "University - 2 years of education studies."
9 "University - 3 years of education studies."
10 "University - 4 years of education studies."
11 "University - 4 years of studies in another area."
12 "Post-graduation in education."
13 "Post-graduation in another area."
;
lab val S7_1_12_0_S7_7 S7_1_12_1_S7_7 S7_1_12_2_S7_7 S7_1_12_3_S7_7 S7_1_12_4_S7_7 S7_1_12_5_S7_7 S7_1_12_6_S7_7 S7_1_12_7_S7_7 S7_1_12_8_S7_7 S7_1_12_9_S7_7 S7_1_12_10_S7_7 S7_1_12_11_S7_7 S7_1_12_12_S7_7 S7_1_12_13_S7_7 S7_1_12_14_S7_7 S7_1_12_15_S7_7 S7_1_12_16_S7_7 S7_1_12_17_S7_7 S7_1_12_18_S7_7 S7_1_12_19_S7_7 S7_1_12_20_S7_7 edu2
;
#delimit cr

lab var S7_1_12_0_S7_7 "(1) Highest level of education enjoyed"
lab var S7_1_12_1_S7_7 "(2) Highest level of education enjoyed"
lab var S7_1_12_2_S7_7 "(3) Highest level of education enjoyed"
lab var S7_1_12_3_S7_7 "(4) Highest level of education enjoyed"
lab var S7_1_12_4_S7_7 "(5) Highest level of education enjoyed"
lab var S7_1_12_5_S7_7 "(6) Highest level of education enjoyed"
lab var S7_1_12_6_S7_7 "(7) Highest level of education enjoyed"
lab var S7_1_12_7_S7_7 "(8) Highest level of education enjoyed"
lab var S7_1_12_8_S7_7 "(9) Highest level of education enjoyed"
lab var S7_1_12_9_S7_7 "(10) Highest level of education enjoyed"
lab var S7_1_12_10_S7_7 "(11) Highest level of education enjoyed"
lab var S7_1_12_11_S7_7 "(12) Highest level of education enjoyed"
lab var S7_1_12_12_S7_7 "(13) Highest level of education enjoyed"
lab var S7_1_12_13_S7_7 "(14) Highest level of education enjoyed"
lab var S7_1_12_14_S7_7 "(15) Highest level of education enjoyed"
lab var S7_1_12_15_S7_7 "(16) Highest level of education enjoyed"
lab var S7_1_12_16_S7_7 "(17) Highest level of education enjoyed"
lab var S7_1_12_17_S7_7 "(18) Highest level of education enjoyed"
lab var S7_1_12_18_S7_7 "(19) Highest level of education enjoyed"
lab var S7_1_12_19_S7_7 "(20) Highest level of education enjoyed"
lab var S7_1_12_20_S7_7 "(21) Highest level of education enjoyed"

rename S7_1_12_0_S7_7 Q7_07_01
rename S7_1_12_1_S7_7 Q7_07_02
rename S7_1_12_2_S7_7 Q7_07_03
rename S7_1_12_3_S7_7 Q7_07_04
rename S7_1_12_4_S7_7 Q7_07_05
rename S7_1_12_5_S7_7 Q7_07_06
rename S7_1_12_6_S7_7 Q7_07_07
rename S7_1_12_7_S7_7 Q7_07_08
rename S7_1_12_8_S7_7 Q7_07_09
rename S7_1_12_9_S7_7 Q7_07_10
rename S7_1_12_10_S7_7 Q7_07_11
rename S7_1_12_11_S7_7 Q7_07_12
rename S7_1_12_12_S7_7 Q7_07_13
rename S7_1_12_13_S7_7 Q7_07_14
rename S7_1_12_14_S7_7 Q7_07_15
rename S7_1_12_15_S7_7 Q7_07_16
rename S7_1_12_16_S7_7 Q7_07_17
rename S7_1_12_17_S7_7 Q7_07_18
rename S7_1_12_18_S7_7 Q7_07_19
rename S7_1_12_19_S7_7 Q7_07_20
rename S7_1_12_20_S7_7 Q7_07_21

lab var S7_1_12_0_S7_7_C9 "AUX"
lab var S7_1_12_1_S7_7_C9 "AUX"
lab var S7_1_12_2_S7_7_C9 "AUX"
lab var S7_1_12_3_S7_7_C9 "AUX"
lab var S7_1_12_4_S7_7_C9 "AUX"
lab var S7_1_12_5_S7_7_C9 "AUX"
lab var S7_1_12_6_S7_7_C9 "AUX"
lab var S7_1_12_7_S7_7_C9 "AUX"
lab var S7_1_12_8_S7_7_C9 "AUX"
lab var S7_1_12_9_S7_7_C9 "AUX"
lab var S7_1_12_10_S7_7_C9 "AUX"
lab var S7_1_12_11_S7_7_C9 "AUX"
lab var S7_1_12_12_S7_7_C9 "AUX"
lab var S7_1_12_13_S7_7_C9 "AUX"
lab var S7_1_12_14_S7_7_C9 "AUX"
lab var S7_1_12_15_S7_7_C9 "AUX"
lab var S7_1_12_16_S7_7_C9 "AUX"
lab var S7_1_12_17_S7_7_C9 "AUX"
lab var S7_1_12_18_S7_7_C9 "AUX"
lab var S7_1_12_19_S7_7_C9 "AUX"
lab var S7_1_12_20_S7_7_C9 "AUX"
lab var S7_1_12_0_S7_7_C11 "AUX"
lab var S7_1_12_1_S7_7_C11 "AUX"
lab var S7_1_12_2_S7_7_C11 "AUX"
lab var S7_1_12_3_S7_7_C11 "AUX"
lab var S7_1_12_4_S7_7_C11 "AUX"
lab var S7_1_12_5_S7_7_C11 "AUX"
lab var S7_1_12_6_S7_7_C11 "AUX"
lab var S7_1_12_7_S7_7_C11 "AUX"
lab var S7_1_12_8_S7_7_C11 "AUX"
lab var S7_1_12_9_S7_7_C11 "AUX"
lab var S7_1_12_10_S7_7_C11 "AUX"
lab var S7_1_12_11_S7_7_C11 "AUX"
lab var S7_1_12_12_S7_7_C11 "AUX"
lab var S7_1_12_13_S7_7_C11 "AUX"
lab var S7_1_12_14_S7_7_C11 "AUX"
lab var S7_1_12_15_S7_7_C11 "AUX"
lab var S7_1_12_16_S7_7_C11 "AUX"
lab var S7_1_12_17_S7_7_C11 "AUX"
lab var S7_1_12_18_S7_7_C11 "AUX"
lab var S7_1_12_19_S7_7_C11 "AUX"
lab var S7_1_12_20_S7_7_C11 "AUX"
lab var S7_1_12_0_S7_7_C12 "AUX"
lab var S7_1_12_1_S7_7_C12 "AUX"
lab var S7_1_12_2_S7_7_C12 "AUX"
lab var S7_1_12_3_S7_7_C12 "AUX"
lab var S7_1_12_4_S7_7_C12 "AUX"
lab var S7_1_12_5_S7_7_C12 "AUX"
lab var S7_1_12_6_S7_7_C12 "AUX"
lab var S7_1_12_7_S7_7_C12 "AUX"
lab var S7_1_12_8_S7_7_C12 "AUX"
lab var S7_1_12_9_S7_7_C12 "AUX"
lab var S7_1_12_10_S7_7_C12 "AUX"
lab var S7_1_12_11_S7_7_C12 "AUX"
lab var S7_1_12_12_S7_7_C12 "AUX"
lab var S7_1_12_13_S7_7_C12 "AUX"
lab var S7_1_12_14_S7_7_C12 "AUX"
lab var S7_1_12_15_S7_7_C12 "AUX"
lab var S7_1_12_16_S7_7_C12 "AUX"
lab var S7_1_12_17_S7_7_C12 "AUX"
lab var S7_1_12_18_S7_7_C12 "AUX"
lab var S7_1_12_19_S7_7_C12 "AUX"
lab var S7_1_12_20_S7_7_C12 "AUX"


lab var S7_1_12_0_S7_8 "(1) Years teaching in this school"
lab var S7_1_12_1_S7_8 "(2) Years teaching in this school"
lab var S7_1_12_2_S7_8 "(3) Years teaching in this school"
lab var S7_1_12_3_S7_8 "(4) Years teaching in this school"
lab var S7_1_12_4_S7_8 "(5) Years teaching in this school"
lab var S7_1_12_5_S7_8 "(6) Years teaching in this school"
lab var S7_1_12_6_S7_8 "(7) Years teaching in this school"
lab var S7_1_12_7_S7_8 "(8) Years teaching in this school"
lab var S7_1_12_8_S7_8 "(9) Years teaching in this school"
lab var S7_1_12_9_S7_8 "(10) Years teaching in this school"
lab var S7_1_12_10_S7_8 "(11) Years teaching in this school"
lab var S7_1_12_11_S7_8 "(12) Years teaching in this school"
lab var S7_1_12_12_S7_8 "(13) Years teaching in this school"
lab var S7_1_12_13_S7_8 "(14) Years teaching in this school"
lab var S7_1_12_14_S7_8 "(15) Years teaching in this school"
lab var S7_1_12_15_S7_8 "(16) Years teaching in this school"
lab var S7_1_12_16_S7_8 "(17) Years teaching in this school"
lab var S7_1_12_17_S7_8 "(18) Years teaching in this school"
lab var S7_1_12_18_S7_8 "(19) Years teaching in this school"
lab var S7_1_12_19_S7_8 "(20) Years teaching in this school"
lab var S7_1_12_20_S7_8 "(21) Years teaching in this school"

rename S7_1_12_0_S7_8 Q7_08_01
rename S7_1_12_1_S7_8 Q7_08_02
rename S7_1_12_2_S7_8 Q7_08_03
rename S7_1_12_3_S7_8 Q7_08_04
rename S7_1_12_4_S7_8 Q7_08_05
rename S7_1_12_5_S7_8 Q7_08_06
rename S7_1_12_6_S7_8 Q7_08_07
rename S7_1_12_7_S7_8 Q7_08_08
rename S7_1_12_8_S7_8 Q7_08_09
rename S7_1_12_9_S7_8 Q7_08_10
rename S7_1_12_10_S7_8 Q7_08_11
rename S7_1_12_11_S7_8 Q7_08_12
rename S7_1_12_12_S7_8 Q7_08_13
rename S7_1_12_13_S7_8 Q7_08_14
rename S7_1_12_14_S7_8 Q7_08_15
rename S7_1_12_15_S7_8 Q7_08_16
rename S7_1_12_16_S7_8 Q7_08_17
rename S7_1_12_17_S7_8 Q7_08_18
rename S7_1_12_18_S7_8 Q7_08_19
rename S7_1_12_19_S7_8 Q7_08_20
rename S7_1_12_20_S7_8 Q7_08_21


lab var S7_1_12_0_S7_9 "(1) Monthly salary"
lab var S7_1_12_1_S7_9 "(2) Monthly salary"
lab var S7_1_12_2_S7_9 "(3) Monthly salary"
lab var S7_1_12_3_S7_9 "(4) Monthly salary"
lab var S7_1_12_4_S7_9 "(5) Monthly salary"
lab var S7_1_12_5_S7_9 "(6) Monthly salary"
lab var S7_1_12_6_S7_9 "(7) Monthly salary"
lab var S7_1_12_7_S7_9 "(8) Monthly salary"
lab var S7_1_12_8_S7_9 "(9) Monthly salary"
lab var S7_1_12_9_S7_9 "(10) Monthly salary"
lab var S7_1_12_10_S7_9 "(11) Monthly salary"
lab var S7_1_12_11_S7_9 "(12) Monthly salary"
lab var S7_1_12_12_S7_9 "(13) Monthly salary"
lab var S7_1_12_13_S7_9 "(14) Monthly salary"
lab var S7_1_12_14_S7_9 "(15) Monthly salary"
lab var S7_1_12_15_S7_9 "(16) Monthly salary"
lab var S7_1_12_16_S7_9 "(17) Monthly salary"
lab var S7_1_12_17_S7_9 "(18) Monthly salary"
lab var S7_1_12_18_S7_9 "(19) Monthly salary"
lab var S7_1_12_19_S7_9 "(20) Monthly salary"
lab var S7_1_12_20_S7_9 "(21) Monthly salary"

rename S7_1_12_0_S7_9 Q7_09_01
rename S7_1_12_1_S7_9 Q7_09_02
rename S7_1_12_2_S7_9 Q7_09_03
rename S7_1_12_3_S7_9 Q7_09_04
rename S7_1_12_4_S7_9 Q7_09_05
rename S7_1_12_5_S7_9 Q7_09_06
rename S7_1_12_6_S7_9 Q7_09_07
rename S7_1_12_7_S7_9 Q7_09_08
rename S7_1_12_8_S7_9 Q7_09_09
rename S7_1_12_9_S7_9 Q7_09_10
rename S7_1_12_10_S7_9 Q7_09_11
rename S7_1_12_11_S7_9 Q7_09_12
rename S7_1_12_12_S7_9 Q7_09_13
rename S7_1_12_13_S7_9 Q7_09_14
rename S7_1_12_14_S7_9 Q7_09_15
rename S7_1_12_15_S7_9 Q7_09_16
rename S7_1_12_16_S7_9 Q7_09_17
rename S7_1_12_17_S7_9 Q7_09_18
rename S7_1_12_18_S7_9 Q7_09_19
rename S7_1_12_19_S7_9 Q7_09_20
rename S7_1_12_20_S7_9 Q7_09_21


drop S7_1_12_0_S7_10_Codes S7_1_12_1_S7_10_Codes S7_1_12_2_S7_10_Codes S7_1_12_3_S7_10_Codes S7_1_12_4_S7_10_Codes S7_1_12_5_S7_10_Codes S7_1_12_6_S7_10_Codes S7_1_12_7_S7_10_Codes S7_1_12_8_S7_10_Codes S7_1_12_9_S7_10_Codes S7_1_12_10_S7_10_Codes S7_1_12_11_S7_10_Codes S7_1_12_12_S7_10_Codes S7_1_12_13_S7_10_Codes S7_1_12_14_S7_10_Codes S7_1_12_15_S7_10_Codes S7_1_12_16_S7_10_Codes S7_1_12_17_S7_10_Codes S7_1_12_18_S7_10_Codes S7_1_12_19_S7_10_Codes S7_1_12_20_S7_10_Codes

lab var S7_1_12_0_S7_10 "(1) Times absent last two weeks"
lab var S7_1_12_1_S7_10 "(2) Times absent last two weeks"
lab var S7_1_12_2_S7_10 "(3) Times absent last two weeks"
lab var S7_1_12_3_S7_10 "(4) Times absent last two weeks"
lab var S7_1_12_4_S7_10 "(5) Times absent last two weeks"
lab var S7_1_12_5_S7_10 "(6) Times absent last two weeks"
lab var S7_1_12_6_S7_10 "(7) Times absent last two weeks"
lab var S7_1_12_7_S7_10 "(8) Times absent last two weeks"
lab var S7_1_12_8_S7_10 "(9) Times absent last two weeks"
lab var S7_1_12_9_S7_10 "(10) Times absent last two weeks"
lab var S7_1_12_10_S7_10 "(11) Times absent last two weeks"
lab var S7_1_12_11_S7_10 "(12) Times absent last two weeks"
lab var S7_1_12_12_S7_10 "(13) Times absent last two weeks"
lab var S7_1_12_13_S7_10 "(14) Times absent last two weeks"
lab var S7_1_12_14_S7_10 "(15) Times absent last two weeks"
lab var S7_1_12_15_S7_10 "(16) Times absent last two weeks"
lab var S7_1_12_16_S7_10 "(17) Times absent last two weeks"
lab var S7_1_12_17_S7_10 "(18) Times absent last two weeks"
lab var S7_1_12_18_S7_10 "(19) Times absent last two weeks"
lab var S7_1_12_19_S7_10 "(20) Times absent last two weeks"
lab var S7_1_12_20_S7_10 "(21) Times absent last two weeks"

rename S7_1_12_0_S7_10 Q7_10_01
rename S7_1_12_1_S7_10 Q7_10_02
rename S7_1_12_2_S7_10 Q7_10_03
rename S7_1_12_3_S7_10 Q7_10_04
rename S7_1_12_4_S7_10 Q7_10_05
rename S7_1_12_5_S7_10 Q7_10_06
rename S7_1_12_6_S7_10 Q7_10_07
rename S7_1_12_7_S7_10 Q7_10_08
rename S7_1_12_8_S7_10 Q7_10_09
rename S7_1_12_9_S7_10 Q7_10_10
rename S7_1_12_10_S7_10 Q7_10_11
rename S7_1_12_11_S7_10 Q7_10_12
rename S7_1_12_12_S7_10 Q7_10_13
rename S7_1_12_13_S7_10 Q7_10_14
rename S7_1_12_14_S7_10 Q7_10_15
rename S7_1_12_15_S7_10 Q7_10_16
rename S7_1_12_16_S7_10 Q7_10_17
rename S7_1_12_17_S7_10 Q7_10_18
rename S7_1_12_18_S7_10 Q7_10_19
rename S7_1_12_19_S7_10 Q7_10_20
rename S7_1_12_20_S7_10 Q7_10_21

forval n=1/9{
gen Q7_missing_0`n' = 0 if Q7_10_0`n'==0
replace Q7_missing_0`n' = 1 if inlist(Q7_10_0`n',1,2,3,4,5)
lab var Q7_missing_0`n' "(`n') Professor was absent sometime during the last two weeks"
}
forval n=10/21{
gen Q7_missing_`n' = 0 if Q7_10_`n'==0
replace Q7_missing_`n' = 1 if inlist(Q7_10_`n',1,2,3,4,5)
lab var Q7_missing_`n' "(`n') Professor was absent sometime during the last two weeks"
}

order Q7_missing_01 Q7_missing_02 Q7_missing_03 Q7_missing_04 Q7_missing_05 Q7_missing_06 Q7_missing_07 Q7_missing_08 Q7_missing_09 Q7_missing_10 Q7_missing_11 Q7_missing_12 Q7_missing_13 Q7_missing_14 Q7_missing_15 Q7_missing_16 Q7_missing_17 Q7_missing_18 Q7_missing_19 Q7_missing_20 Q7_missing_21, after(Q7_10_21)

drop S7_1_12_0_S7_11_Codes S7_1_12_1_S7_11_Codes S7_1_12_2_S7_11_Codes S7_1_12_3_S7_11_Codes S7_1_12_4_S7_11_Codes S7_1_12_5_S7_11_Codes S7_1_12_6_S7_11_Codes S7_1_12_7_S7_11_Codes S7_1_12_8_S7_11_Codes S7_1_12_9_S7_11_Codes S7_1_12_10_S7_11_Codes S7_1_12_11_S7_11_Codes S7_1_12_12_S7_11_Codes S7_1_12_13_S7_11_Codes S7_1_12_14_S7_11_Codes S7_1_12_15_S7_11_Codes S7_1_12_16_S7_11_Codes S7_1_12_17_S7_11_Codes S7_1_12_18_S7_11_Codes S7_1_12_19_S7_11_Codes S7_1_12_20_S7_11_Codes

lab var S7_1_12_0_S7_11 "(1) Times absent during May last year"
lab var S7_1_12_1_S7_11 "(2) Times absent during May last year"
lab var S7_1_12_2_S7_11 "(3) Times absent during May last year"
lab var S7_1_12_3_S7_11 "(4) Times absent during May last year"
lab var S7_1_12_4_S7_11 "(5) Times absent during May last year"
lab var S7_1_12_5_S7_11 "(6) Times absent during May last year"
lab var S7_1_12_6_S7_11 "(7) Times absent during May last year"
lab var S7_1_12_7_S7_11 "(8) Times absent during May last year"
lab var S7_1_12_8_S7_11 "(9) Times absent during May last year"
lab var S7_1_12_9_S7_11 "(10) Times absent during May last year"
lab var S7_1_12_10_S7_11 "(11) Times absent during May last year"
lab var S7_1_12_11_S7_11 "(12) Times absent during May last year"
lab var S7_1_12_12_S7_11 "(13) Times absent during May last year"
lab var S7_1_12_13_S7_11 "(14) Times absent during May last year"
lab var S7_1_12_14_S7_11 "(15) Times absent during May last year"
lab var S7_1_12_15_S7_11 "(16) Times absent during May last year"
lab var S7_1_12_16_S7_11 "(17) Times absent during May last year"
lab var S7_1_12_17_S7_11 "(18) Times absent during May last year"
lab var S7_1_12_18_S7_11 "(19) Times absent during May last year"
lab var S7_1_12_19_S7_11 "(20) Times absent during May last year"
lab var S7_1_12_20_S7_11 "(21) Times absent during May last year"

rename S7_1_12_0_S7_11 Q7_11_01
rename S7_1_12_1_S7_11 Q7_11_02
rename S7_1_12_2_S7_11 Q7_11_03
rename S7_1_12_3_S7_11 Q7_11_04
rename S7_1_12_4_S7_11 Q7_11_05
rename S7_1_12_5_S7_11 Q7_11_06
rename S7_1_12_6_S7_11 Q7_11_07
rename S7_1_12_7_S7_11 Q7_11_08
rename S7_1_12_8_S7_11 Q7_11_09
rename S7_1_12_9_S7_11 Q7_11_10
rename S7_1_12_10_S7_11 Q7_11_11
rename S7_1_12_11_S7_11 Q7_11_12
rename S7_1_12_12_S7_11 Q7_11_13
rename S7_1_12_13_S7_11 Q7_11_14
rename S7_1_12_14_S7_11 Q7_11_15
rename S7_1_12_15_S7_11 Q7_11_16
rename S7_1_12_16_S7_11 Q7_11_17
rename S7_1_12_17_S7_11 Q7_11_18
rename S7_1_12_18_S7_11 Q7_11_19
rename S7_1_12_19_S7_11 Q7_11_20
rename S7_1_12_20_S7_11 Q7_11_21

lab var S7_1_12_0_S7_12 "(1) Reason for missing"
lab var S7_1_12_1_S7_12 "(2) Reason for missing"
lab var S7_1_12_2_S7_12 "(3) Reason for missing"
lab var S7_1_12_3_S7_12 "(4) Reason for missing"
lab var S7_1_12_4_S7_12 "(5) Reason for missing"
lab var S7_1_12_5_S7_12 "(6) Reason for missing"
lab var S7_1_12_6_S7_12 "(7) Reason for missing"
lab var S7_1_12_7_S7_12 "(8) Reason for missing"
lab var S7_1_12_8_S7_12 "(9) Reason for missing"
lab var S7_1_12_9_S7_12 "(10) Reason for missing"
lab var S7_1_12_10_S7_12 "(11) Reason for missing"
lab var S7_1_12_11_S7_12 "(12) Reason for missing"
lab var S7_1_12_12_S7_12 "(13) Reason for missing"
lab var S7_1_12_13_S7_12 "(14) Reason for missing"
lab var S7_1_12_14_S7_12 "(15) Reason for missing"
lab var S7_1_12_15_S7_12 "(16) Reason for missing"
lab var S7_1_12_16_S7_12 "(17) Reason for missing"
lab var S7_1_12_17_S7_12 "(18) Reason for missing"
lab var S7_1_12_18_S7_12 "(19) Reason for missing"
lab var S7_1_12_19_S7_12 "(20) Reason for missing"
lab var S7_1_12_20_S7_12 "(21) Reason for missing"

rename S7_1_12_0_S7_12 Q7_12_01
rename S7_1_12_1_S7_12 Q7_12_02
rename S7_1_12_2_S7_12 Q7_12_03
rename S7_1_12_3_S7_12 Q7_12_04
rename S7_1_12_4_S7_12 Q7_12_05
rename S7_1_12_5_S7_12 Q7_12_06
rename S7_1_12_6_S7_12 Q7_12_07
rename S7_1_12_7_S7_12 Q7_12_08
rename S7_1_12_8_S7_12 Q7_12_09
rename S7_1_12_9_S7_12 Q7_12_10
rename S7_1_12_10_S7_12 Q7_12_11
rename S7_1_12_11_S7_12 Q7_12_12
rename S7_1_12_12_S7_12 Q7_12_13
rename S7_1_12_13_S7_12 Q7_12_14
rename S7_1_12_14_S7_12 Q7_12_15
rename S7_1_12_15_S7_12 Q7_12_16
rename S7_1_12_16_S7_12 Q7_12_17
rename S7_1_12_17_S7_12 Q7_12_18
rename S7_1_12_18_S7_12 Q7_12_19
rename S7_1_12_19_S7_12 Q7_12_20
rename S7_1_12_20_S7_12 Q7_12_21

foreach var in Q7_12_01 Q7_12_02 Q7_12_03 Q7_12_04 Q7_12_05 Q7_12_06 Q7_12_07 Q7_12_08 Q7_12_09 Q7_12_10 Q7_12_11 Q7_12_12 Q7_12_13 Q7_12_14 Q7_12_15 Q7_12_16 Q7_12_17 Q7_12_18 Q7_12_19 Q7_12_20 Q7_12_21{
replace `var' = . if inlist(`var',6,7,8)
}
replace Q7_12_01 = 6 if S7_1_12_0_S7_12_C8=="A motorizada avariou a caminho da escola"
replace Q7_12_01 = 6 if S7_1_12_0_S7_12_C8=="Chuva"
replace Q7_12_01 = 6 if S7_1_12_0_S7_12_C8=="Chuvas"
replace Q7_12_01 = 6 if S7_1_12_0_S7_12_C8=="Falta de transporte"
replace Q7_12_01 = 6 if S7_1_12_0_S7_12_C8=="chuva"
replace Q7_12_01 = 5 if S7_1_12_0_S7_12_C8=="doença do Marido"
replace Q7_12_01 = 5 if S7_1_12_0_S7_12_C8=="obito de c6nhado"
replace Q7_12_01 = 5 if S7_1_12_0_S7_12_C8=="peso com a bebe"
replace Q7_12_01 = 3 if S7_1_12_0_S7_12_C8=="trabalhos escolares"
replace Q7_12_01 = 5 if S7_1_12_0_S7_12_C8=="Óbito"
replace Q7_12_01 = 5 if S7_1_12_0_S7_12_C8=="óbito"

replace Q7_12_02 = 5 if S7_1_12_1_S7_12_C8=="Acidente"
replace Q7_12_02 = 6 if S7_1_12_1_S7_12_C8=="Chuva"
replace Q7_12_02 = 5 if S7_1_12_1_S7_12_C8=="levou a filha ao hospital"
replace Q7_12_02 = 5 if S7_1_12_1_S7_12_C8=="levouo bebe ao peso"
replace Q7_12_02 = 5 if S7_1_12_1_S7_12_C8=="obito"
replace Q7_12_02 = 5 if S7_1_12_1_S7_12_C8=="Óbito"
replace Q7_12_02 = 5 if S7_1_12_1_S7_12_C8=="óbito"

replace Q7_12_03 = 6 if S7_1_12_2_S7_12_C8=="Chuva"
replace Q7_12_03 = 5 if S7_1_12_2_S7_12_C8=="esteveem obito"
replace Q7_12_03 = 5 if S7_1_12_2_S7_12_C8=="filho doente"
replace Q7_12_03 = 5 if S7_1_12_2_S7_12_C8=="óbito"

replace Q7_12_04 = 5 if S7_1_12_3_S7_12_C8=="obito"
replace Q7_12_04 = 5 if S7_1_12_3_S7_12_C8=="obito,consulta pre natal"
replace Q7_12_04 = 5 if S7_1_12_3_S7_12_C8=="óbito"

replace Q7_12_05 = 5 if S7_1_12_4_S7_12_C8=="casamento da sobrinha"

replace Q7_12_07 = 5 if S7_1_12_6_S7_12_C8=="Óbito"

replace Q7_12_08 = 5 if S7_1_12_7_S7_12_C8=="Ppara ir ao funeral"

replace Q7_12_11 = 5 if S7_1_12_10_S7_12_C8=="Óbito"

replace Q7_12_17 = . if S7_1_12_16_S7_12_C8=="Justificada"

#delimit ;
;
lab def Q7_12
1	"Workshop/training"
2	"Payday"
3	"Buying school supplies"
4	"Health problems"
5	"Other personal emergency"
6	"Unforeseen circumstances"
;
lab val Q7_12_* Q7_12;
#delimit cr

lab var S7_1_12_0_S7_12_C8 "AUX"
lab var S7_1_12_1_S7_12_C8 "AUX"
lab var S7_1_12_2_S7_12_C8 "AUX"
lab var S7_1_12_3_S7_12_C8 "AUX"
lab var S7_1_12_4_S7_12_C8 "AUX"
lab var S7_1_12_5_S7_12_C8 "AUX"
lab var S7_1_12_6_S7_12_C8 "AUX"
lab var S7_1_12_7_S7_12_C8 "AUX"
lab var S7_1_12_8_S7_12_C8 "AUX"
lab var S7_1_12_9_S7_12_C8 "AUX"
lab var S7_1_12_10_S7_12_C8 "AUX"
lab var S7_1_12_11_S7_12_C8 "AUX"
lab var S7_1_12_12_S7_12_C8 "AUX"
lab var S7_1_12_13_S7_12_C8 "AUX"
lab var S7_1_12_14_S7_12_C8 "AUX"
lab var S7_1_12_15_S7_12_C8 "AUX"
lab var S7_1_12_16_S7_12_C8 "AUX"
lab var S7_1_12_17_S7_12_C8 "AUX"
lab var S7_1_12_18_S7_12_C8 "AUX"
lab var S7_1_12_19_S7_12_C8 "AUX"
lab var S7_1_12_20_S7_12_C8 "AUX"


forval n=1/21 {
gen prof`n' = 1 if Q7_01>=`n'
}

foreach var in prof1 prof2 prof3 prof4 prof5 prof6 prof7 prof8 prof9 prof10 prof11 prof12 prof13 prof14 prof15 prof16 prof17 prof18 prof19 prof20 prof21{
lab var `var' "AUX"
}

forval n=1/9{
replace Q7_04_0`n' = . if prof`n'==.
replace Q7_06_0`n' = . if prof`n'==.
replace Q7_07_0`n' = . if prof`n'==.
replace Q7_08_0`n' = . if prof`n'==.
replace Q7_09_0`n' = . if prof`n'==.
replace Q7_10_0`n' = . if prof`n'==.
replace Q7_11_0`n' = . if prof`n'==.
replace Q7_12_0`n' = . if prof`n'==.
}

forval n=10/21{
replace Q7_04_`n' = . if prof`n'==.
replace Q7_06_`n' = . if prof`n'==.
replace Q7_07_`n' = . if prof`n'==.
replace Q7_08_`n' = . if prof`n'==.
replace Q7_09_`n' = . if prof`n'==.
replace Q7_10_`n' = . if prof`n'==.
replace Q7_11_`n' = . if prof`n'==.
replace Q7_12_`n' = . if prof`n'==.
}


lab var S7_13 "Number of professors that have left the school in the last 5 years"
rename S7_13 Q7_13

forval n=1/13 {
gen exprof`n' = 1 if Q7_13>=`n'
}

foreach var in exprof1 exprof2 exprof3 exprof4 exprof5 exprof6 exprof7 exprof8 exprof9 exprof10 exprof11 exprof12 exprof13{
lab var `var' "AUX"
}

lab var S7_14_15_0_S7_14 "(1) Reason for leaving"
lab var S7_14_15_1_S7_14 "(2) Reason for leaving"
lab var S7_14_15_2_S7_14 "(3) Reason for leaving"
lab var S7_14_15_3_S7_14 "(4) Reason for leaving"
lab var S7_14_15_4_S7_14 "(5) Reason for leaving"
lab var S7_14_15_5_S7_14 "(6) Reason for leaving"
lab var S7_14_15_6_S7_14 "(7) Reason for leaving"
lab var S7_14_15_7_S7_14 "(8) Reason for leaving"
lab var S7_14_15_8_S7_14 "(9) Reason for leaving"
lab var S7_14_15_9_S7_14 "(10) Reason for leaving"
lab var S7_14_15_10_S7_14 "(11) Reason for leaving"
lab var S7_14_15_11_S7_14 "(12) Reason for leaving"
lab var S7_14_15_12_S7_14 "(13) Reason for leaving"

lab var S7_14_15_0_S7_14_C9 "AUX"
lab var S7_14_15_1_S7_14_C9 "AUX"
lab var S7_14_15_2_S7_14_C9 "AUX"
lab var S7_14_15_3_S7_14_C9 "AUX"
lab var S7_14_15_4_S7_14_C9 "AUX"
lab var S7_14_15_5_S7_14_C9 "AUX"
lab var S7_14_15_6_S7_14_C9 "AUX"
lab var S7_14_15_7_S7_14_C9 "AUX"
lab var S7_14_15_8_S7_14_C9 "AUX"
lab var S7_14_15_9_S7_14_C9 "AUX"
lab var S7_14_15_10_S7_14_C9 "AUX"
lab var S7_14_15_11_S7_14_C9 "AUX"
lab var S7_14_15_12_S7_14_C9 "AUX"

foreach var in S7_14_15_0_S7_14 S7_14_15_1_S7_14 S7_14_15_2_S7_14 S7_14_15_3_S7_14 S7_14_15_4_S7_14 S7_14_15_5_S7_14 S7_14_15_6_S7_14 S7_14_15_7_S7_14 S7_14_15_8_S7_14 S7_14_15_9_S7_14 S7_14_15_10_S7_14 S7_14_15_11_S7_14 S7_14_15_12_S7_14{
replace `var'=. if `var'==9
}

replace S7_14_15_0_S7_14 = 3 if S7_14_15_0_S7_14_C9=="morte"

replace S7_14_15_1_S7_14 = 5 if S7_14_15_1_S7_14_C9=="Promoção para a DPE"
replace S7_14_15_1_S7_14 = 9 if S7_14_15_1_S7_14_C9=="trocou de emprego"

replace S7_14_15_2_S7_14 = 9 if S7_14_15_2_S7_14_C9=="Mudança de emprego"

replace S7_14_15_4_S7_14 = 8 if S7_14_15_4_S7_14_C9=="Prisão"
replace S7_14_15_4_S7_14 = . if S7_14_15_4_S7_14_C9=="bolsa de estudo"

rename S7_14_15_0_S7_14 Q7_14_01
rename S7_14_15_1_S7_14 Q7_14_02
rename S7_14_15_2_S7_14 Q7_14_03
rename S7_14_15_3_S7_14 Q7_14_04
rename S7_14_15_4_S7_14 Q7_14_05
rename S7_14_15_5_S7_14 Q7_14_06
rename S7_14_15_6_S7_14 Q7_14_07
rename S7_14_15_7_S7_14 Q7_14_08
rename S7_14_15_8_S7_14 Q7_14_09
rename S7_14_15_9_S7_14 Q7_14_10
rename S7_14_15_10_S7_14 Q7_14_11
rename S7_14_15_11_S7_14 Q7_14_12
rename S7_14_15_12_S7_14 Q7_14_13

#delimit;
;
lab def Q7_14
1 "Retirement"
2 "Disease"
3 "Death"
4 "Transfer with the same position to another school"
5 "Promotion to a position above in another school"
6 "Transfer due to problems in this school"
7 "Interruption of work once the number of students dropped"
8 "Dismissal"
9 "Change of employment"
;
lab val Q7_14_01 Q7_14_02 Q7_14_03 Q7_14_04 Q7_14_05 Q7_14_06 Q7_14_07 Q7_14_08 Q7_14_09 Q7_14_10 Q7_14_11 Q7_14_12 Q7_14_13 Q7_14
;
#delimit cr

rename S7_14_15_0_S7_151 exprof1_na
rename S7_14_15_0_S7_152 exprof1_dir_esc
rename S7_14_15_0_S7_153 exprof1_dir_munedu
rename S7_14_15_0_S7_154 exprof1_dir_provedu
rename S7_14_15_0_S7_155 exprof1_ministro
rename S7_14_15_1_S7_151 exprof2_na
rename S7_14_15_1_S7_152 exprof2_dir_esc
rename S7_14_15_1_S7_153 exprof2_dir_munedu
rename S7_14_15_1_S7_154 exprof2_dir_provedu
rename S7_14_15_1_S7_155 exprof2_ministro
rename S7_14_15_2_S7_151 exprof3_na
rename S7_14_15_2_S7_152 exprof3_dir_esc
rename S7_14_15_2_S7_153 exprof3_dir_munedu
rename S7_14_15_2_S7_154 exprof3_dir_provedu
rename S7_14_15_2_S7_155 exprof3_ministro
rename S7_14_15_3_S7_151 exprof4_na
rename S7_14_15_3_S7_152 exprof4_dir_esc
rename S7_14_15_3_S7_153 exprof4_dir_munedu
rename S7_14_15_3_S7_154 exprof4_dir_provedu
rename S7_14_15_3_S7_155 exprof4_ministro
rename S7_14_15_4_S7_151 exprof5_na
rename S7_14_15_4_S7_152 exprof5_dir_esc
rename S7_14_15_4_S7_153 exprof5_dir_munedu
rename S7_14_15_4_S7_154 exprof5_dir_provedu
rename S7_14_15_4_S7_155 exprof5_ministro
rename S7_14_15_5_S7_151 exprof6_na
rename S7_14_15_5_S7_152 exprof6_dir_esc
rename S7_14_15_5_S7_153 exprof6_dir_munedu
rename S7_14_15_5_S7_154 exprof6_dir_provedu
rename S7_14_15_5_S7_155 exprof6_ministro
rename S7_14_15_6_S7_151 exprof7_na
rename S7_14_15_6_S7_152 exprof7_dir_esc
rename S7_14_15_6_S7_153 exprof7_dir_munedu
rename S7_14_15_6_S7_154 exprof7_dir_provedu
rename S7_14_15_6_S7_155 exprof7_ministro
rename S7_14_15_7_S7_151 exprof8_na
rename S7_14_15_7_S7_152 exprof8_dir_esc
rename S7_14_15_7_S7_153 exprof8_dir_munedu
rename S7_14_15_7_S7_154 exprof8_dir_provedu
rename S7_14_15_7_S7_155 exprof8_ministro
rename S7_14_15_8_S7_151 exprof9_na
rename S7_14_15_8_S7_152 exprof9_dir_esc
rename S7_14_15_8_S7_153 exprof9_dir_munedu
rename S7_14_15_8_S7_154 exprof9_dir_provedu
rename S7_14_15_8_S7_155 exprof9_ministro
rename S7_14_15_9_S7_151 exprof10_na
rename S7_14_15_9_S7_152 exprof10_dir_esc
rename S7_14_15_9_S7_153 exprof10_dir_munedu
rename S7_14_15_9_S7_154 exprof10_dir_provedu
rename S7_14_15_9_S7_155 exprof10_ministro
rename S7_14_15_10_S7_151 exprof11_na
rename S7_14_15_10_S7_152 exprof11_dir_esc
rename S7_14_15_10_S7_153 exprof11_dir_munedu
rename S7_14_15_10_S7_154 exprof11_dir_provedu
rename S7_14_15_10_S7_155 exprof11_ministro
rename S7_14_15_11_S7_151 exprof12_na
rename S7_14_15_11_S7_152 exprof12_dir_esc
rename S7_14_15_11_S7_153 exprof12_dir_munedu
rename S7_14_15_11_S7_154 exprof12_dir_provedu
rename S7_14_15_11_S7_155 exprof12_ministro
rename S7_14_15_12_S7_151 exprof13_na
rename S7_14_15_12_S7_152 exprof13_dir_esc
rename S7_14_15_12_S7_153 exprof13_dir_munedu
rename S7_14_15_12_S7_154 exprof13_dir_provedu
rename S7_14_15_12_S7_155 exprof13_ministro

forval n=1/13{
gen exprof`n'_own = .
}

replace exprof1_own = 1 if S7_14_15_0_S7_15_C6=="Mudança de residencia"
replace exprof1_own = 1 if S7_14_15_0_S7_15_C6=="Solicitação pessoal"
replace exprof1_own = 1 if S7_14_15_0_S7_15_C6=="a pedido proprio"
replace exprof1_own = 1 if S7_14_15_0_S7_15_C6=="a pedido próprio"
replace exprof1_own = 1 if S7_14_15_0_S7_15_C6=="ao pedido dela"
replace exprof1_own = 1 if S7_14_15_0_S7_15_C6=="de proprio"
replace exprof1_dir_munedu = 1 if S7_14_15_0_S7_15_C6=="direçao municipal"
replace exprof1_dir_munedu = 1 if S7_14_15_0_S7_15_C6=="direção comunal"
replace exprof1_own = 1 if S7_14_15_0_S7_15_C6=="pedido próprio"
replace exprof1_own = 1 if S7_14_15_0_S7_15_C6=="por opçao"
replace exprof1_na = 1 if S7_14_15_0_S7_15_C6=="repartiçao"
replace exprof1_na = 1 if S7_14_15_0_S7_15_C6=="rotação"
replace exprof1_dir_munedu = 1 if S7_14_15_0_S7_15_C6=="secção municipal"
replace exprof1_dir_munedu = 1 if S7_14_15_0_S7_15_C6=="coordenação comunal"

replace exprof2_na = 1 if S7_14_15_1_S7_15_C6=="Rotatividade de trabalho"
replace exprof2_own = 1 if S7_14_15_1_S7_15_C6=="Solicitação pessoal"
replace exprof2_own = 1 if S7_14_15_1_S7_15_C6=="a pedido proprio"
replace exprof2_own = 1 if S7_14_15_1_S7_15_C6=="a pedido próprio"
replace exprof2_own = 1 if S7_14_15_1_S7_15_C6=="de proprio"
replace exprof2_dir_munedu = 1 if S7_14_15_1_S7_15_C6=="direçao municipal"
replace exprof2_dir_munedu = 1 if S7_14_15_1_S7_15_C6=="direção comunal"
replace exprof2_own = 1 if S7_14_15_1_S7_15_C6=="pedido da propria"
replace exprof2_own = 1 if S7_14_15_1_S7_15_C6=="propria"
replace exprof2_own = 1 if S7_14_15_1_S7_15_C6=="proprio"
replace exprof2_na = 1 if S7_14_15_1_S7_15_C6=="reparticao"
replace exprof2_na = 1 if S7_14_15_1_S7_15_C6=="repartiçao"
replace exprof2_na = 1 if S7_14_15_1_S7_15_C6=="rotação"
replace exprof2_dir_munedu = 1 if S7_14_15_1_S7_15_C6=="secção municipal"

replace exprof3_own = 1 if S7_14_15_2_S7_15_C6=="Solicitação pessoal"
replace exprof3_own = 1 if S7_14_15_2_S7_15_C6=="a pedido proprio"
replace exprof3_own = 1 if S7_14_15_2_S7_15_C6=="pedido proprio"
replace exprof3_own = 1 if S7_14_15_2_S7_15_C6=="pedido próprio"
replace exprof3_own = 1 if S7_14_15_2_S7_15_C6=="proprio"
replace exprof3_na = 1 if S7_14_15_2_S7_15_C6=="repartiçao"
replace exprof3_na = 1 if S7_14_15_2_S7_15_C6=="rotação"
replace exprof3_dir_munedu = 1 if S7_14_15_2_S7_15_C6=="secção municipal"
replace exprof3_dir_munedu = 1 if S7_14_15_2_S7_15_C6=="direção comunal"
replace exprof3_dir_munedu = 1 if S7_14_15_2_S7_15_C6=="Pedido da coordenação"
replace exprof3_dir_esc = 1 if S7_14_15_2_S7_15_C6=="a pedido dos professores"

replace exprof4_own = 1 if S7_14_15_3_S7_15_C6=="a pedido proprio"
replace exprof4_dir_munedu = 1 if S7_14_15_3_S7_15_C6=="administração municipal"
replace exprof4_dir_munedu = 1 if S7_14_15_3_S7_15_C6=="direção comunal"
replace exprof4_own = 1 if S7_14_15_3_S7_15_C6=="pedido"
replace exprof4_own = 1 if S7_14_15_3_S7_15_C6=="pedido proprio"
replace exprof4_own = 1 if S7_14_15_3_S7_15_C6=="proprio"
replace exprof4_na = 1 if S7_14_15_3_S7_15_C6=="repartiçao"
replace exprof4_na = 1 if S7_14_15_3_S7_15_C6=="rotação"
replace exprof4_dir_munedu = 1 if S7_14_15_3_S7_15_C6=="secção municipal"
replace exprof4_na = 1 if S7_14_15_3_S7_15_C6=="troca com outro professor"
replace exprof4_dir_esc = 1 if S7_14_15_3_S7_15_C6=="a pedido dos professores"

replace exprof5_own = 1 if S7_14_15_4_S7_15_C6=="pedido proprio"
replace exprof5_own = 1 if S7_14_15_4_S7_15_C6=="pedido próprio"
replace exprof5_own = 1 if S7_14_15_4_S7_15_C6=="proprio"
replace exprof5_na = 1 if S7_14_15_4_S7_15_C6=="repartiçao"
replace exprof5_na = 1 if S7_14_15_4_S7_15_C6=="rotação"
replace exprof5_dir_esc = 1 if S7_14_15_4_S7_15_C6=="a pedido dos professores"

replace exprof6_dir_esc = 1 if S7_14_15_5_S7_15_C6=="a pedido dos professores"
replace exprof6_own = 1 if S7_14_15_5_S7_15_C6=="pedido proprio"
replace exprof6_own = 1 if S7_14_15_5_S7_15_C6=="pedido próprio"
replace exprof6_na = 1 if S7_14_15_5_S7_15_C6=="repartiçao"

replace exprof7_dir_esc = 1 if S7_14_15_6_S7_15_C6=="a pedido dos professores"
replace exprof7_dir_munedu = 1 if S7_14_15_6_S7_15_C6=="coodenaçao comunal"
replace exprof7_own = 1 if S7_14_15_6_S7_15_C6=="pedido proprio"
replace exprof7_own = 1 if S7_14_15_6_S7_15_C6=="pedido próprio"
replace exprof7_na = 1 if S7_14_15_6_S7_15_C6=="repartiçao"

replace exprof8_dir_esc = 1 if S7_14_15_7_S7_15_C6=="a pedido da professora"
replace exprof8_own = 1 if S7_14_15_7_S7_15_C6=="pedido proprio"
replace exprof8_own = 1 if S7_14_15_7_S7_15_C6=="pedido próprio"

replace exprof9_own = 1 if S7_14_15_8_S7_15_C6=="a pedido proprio"
replace exprof9_own = 1 if S7_14_15_8_S7_15_C6=="pedido próprio"

replace exprof10_own = 1 if S7_14_15_9_S7_15_C6=="pedido próprio"

order exprof1_na exprof1_dir_esc exprof1_dir_munedu exprof1_dir_provedu exprof1_ministro exprof1_own exprof2_na exprof2_dir_esc exprof2_dir_munedu exprof2_dir_provedu exprof2_ministro exprof2_own exprof3_na exprof3_dir_esc exprof3_dir_munedu exprof3_dir_provedu exprof3_ministro exprof3_own exprof4_na exprof4_dir_esc exprof4_dir_munedu exprof4_dir_provedu exprof4_ministro exprof4_own exprof5_na exprof5_dir_esc exprof5_dir_munedu exprof5_dir_provedu exprof5_ministro exprof5_own exprof6_na exprof6_dir_esc exprof6_dir_munedu exprof6_dir_provedu exprof6_ministro exprof6_own exprof7_na  exprof7_dir_esc exprof7_dir_munedu exprof7_dir_provedu exprof7_ministro exprof7_own exprof8_na exprof8_dir_esc exprof8_dir_munedu exprof8_dir_provedu exprof8_ministro exprof8_own exprof9_na exprof9_dir_esc exprof9_dir_munedu exprof9_dir_provedu exprof9_ministro exprof9_own exprof10_na exprof10_dir_esc exprof10_dir_munedu exprof10_dir_provedu exprof10_ministro exprof10_own exprof11_na exprof11_dir_esc exprof11_dir_munedu exprof11_dir_provedu exprof11_ministro exprof11_own exprof12_na exprof12_dir_esc exprof12_dir_munedu exprof12_dir_provedu exprof12_ministro exprof12_own exprof13_na exprof13_dir_esc exprof13_dir_munedu exprof13_dir_provedu exprof13_ministro exprof13_own, after(S7_14_15_12_S7_14_C9)

lab var exprof1_na "Decision for transfer not applicable "
lab var exprof1_dir_esc "Decision for transfer made by school director"
lab var exprof1_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof1_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof1_ministro "Decision for transfer made by the minister"
lab var exprof1_own "Decision for transfer made by the professor"
lab var exprof2_na "Decision for transfer not applicable "
lab var exprof2_dir_esc "Decision for transfer made by school director"
lab var exprof2_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof2_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof2_ministro "Decision for transfer made by the minister"
lab var exprof2_own "Decision for transfer made by the professor"
lab var exprof3_na "Decision for transfer not applicable "
lab var exprof3_dir_esc "Decision for transfer made by school director"
lab var exprof3_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof3_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof3_ministro "Decision for transfer made by the minister"
lab var exprof3_own "Decision for transfer made by the professor"
lab var exprof4_na "Decision for transfer not applicable "
lab var exprof4_dir_esc "Decision for transfer made by school director"
lab var exprof4_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof4_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof4_ministro "Decision for transfer made by the minister"
lab var exprof4_own "Decision for transfer made by the professor"
lab var exprof5_na "Decision for transfer not applicable "
lab var exprof5_dir_esc "Decision for transfer made by school director"
lab var exprof5_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof5_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof5_ministro "Decision for transfer made by the minister"
lab var exprof5_own "Decision for transfer made by the professor"
lab var exprof6_na "Decision for transfer not applicable "
lab var exprof6_dir_esc "Decision for transfer made by school director"
lab var exprof6_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof6_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof6_ministro "Decision for transfer made by the minister"
lab var exprof6_own "Decision for transfer made by the professor"
lab var exprof7_na "Decision for transfer not applicable "
lab var exprof7_dir_esc "Decision for transfer made by school director"
lab var exprof7_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof7_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof7_ministro "Decision for transfer made by the minister"
lab var exprof7_own "Decision for transfer made by the professor"
lab var exprof8_na "Decision for transfer not applicable "
lab var exprof8_dir_esc "Decision for transfer made by school director"
lab var exprof8_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof8_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof8_ministro "Decision for transfer made by the minister"
lab var exprof8_own "Decision for transfer made by the professor"
lab var exprof9_na "Decision for transfer not applicable "
lab var exprof9_dir_esc "Decision for transfer made by school director"
lab var exprof9_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof9_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof9_ministro "Decision for transfer made by the minister"
lab var exprof9_own "Decision for transfer made by the professor"
lab var exprof10_na "Decision for transfer not applicable "
lab var exprof10_dir_esc "Decision for transfer made by school director"
lab var exprof10_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof10_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof10_ministro "Decision for transfer made by the minister"
lab var exprof10_own "Decision for transfer made by the professor"
lab var exprof11_na "Decision for transfer not applicable "
lab var exprof11_dir_esc "Decision for transfer made by school director"
lab var exprof11_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof11_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof11_ministro "Decision for transfer made by the minister"
lab var exprof11_own "Decision for transfer made by the professor"
lab var exprof12_na "Decision for transfer not applicable "
lab var exprof12_dir_esc "Decision for transfer made by school director"
lab var exprof12_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof12_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof12_ministro "Decision for transfer made by the minister"
lab var exprof12_own "Decision for transfer made by the professor"
lab var exprof13_na "Decision for transfer not applicable "
lab var exprof13_dir_esc "Decision for transfer made by school director"
lab var exprof13_dir_munedu "Decision for transfer made by municipality direction of education (including comunal and general municipality admin)"
lab var exprof13_dir_provedu "Decision for transfer made by provincial direction of education"
lab var exprof13_ministro "Decision for transfer made by the minister"
lab var exprof13_own "Decision for transfer made by the professor"

egen exproftotal1 = rowtotal(exprof1_na exprof1_dir_esc exprof1_dir_munedu exprof1_dir_provedu exprof1_ministro exprof1_own)
egen exproftotal2 = rowtotal(exprof2_na exprof2_dir_esc exprof2_dir_munedu exprof2_dir_provedu exprof2_ministro exprof2_own)
egen exproftotal3 = rowtotal(exprof3_na exprof3_dir_esc exprof3_dir_munedu exprof3_dir_provedu exprof3_ministro exprof3_own)
egen exproftotal4 = rowtotal(exprof4_na exprof4_dir_esc exprof4_dir_munedu exprof4_dir_provedu exprof4_ministro exprof4_own)
egen exproftotal5 = rowtotal(exprof5_na exprof5_dir_esc exprof5_dir_munedu exprof5_dir_provedu exprof5_ministro exprof5_own)
egen exproftotal6 = rowtotal(exprof6_na exprof6_dir_esc exprof6_dir_munedu exprof6_dir_provedu exprof6_ministro exprof6_own)
egen exproftotal7 = rowtotal(exprof7_na exprof7_dir_esc exprof7_dir_munedu exprof7_dir_provedu exprof7_ministro exprof7_own)
egen exproftotal8 = rowtotal(exprof8_na exprof8_dir_esc exprof8_dir_munedu exprof8_dir_provedu exprof8_ministro exprof8_own)
egen exproftotal9 = rowtotal(exprof9_na exprof9_dir_esc exprof9_dir_munedu exprof9_dir_provedu exprof9_ministro exprof9_own)
egen exproftotal10 = rowtotal(exprof10_na exprof10_dir_esc exprof10_dir_munedu exprof10_dir_provedu exprof10_ministro exprof10_own)
egen exproftotal11 = rowtotal(exprof11_na exprof11_dir_esc exprof11_dir_munedu exprof11_dir_provedu exprof11_ministro exprof11_own)
egen exproftotal12 = rowtotal(exprof12_na exprof12_dir_esc exprof12_dir_munedu exprof12_dir_provedu exprof12_ministro exprof12_own)
egen exproftotal13 = rowtotal(exprof13_na exprof13_dir_esc exprof13_dir_munedu exprof13_dir_provedu exprof13_ministro exprof13_own)

foreach var in exprof1_na exprof1_dir_esc exprof1_dir_munedu exprof1_dir_provedu exprof1_ministro exprof1_own exprof2_na exprof2_dir_esc exprof2_dir_munedu exprof2_dir_provedu exprof2_ministro exprof2_own exprof3_na exprof3_dir_esc exprof3_dir_munedu exprof3_dir_provedu exprof3_ministro exprof3_own exprof4_na exprof4_dir_esc exprof4_dir_munedu exprof4_dir_provedu exprof4_ministro exprof4_own exprof5_na exprof5_dir_esc exprof5_dir_munedu exprof5_dir_provedu exprof5_ministro exprof5_own exprof6_na exprof6_dir_esc exprof6_dir_munedu exprof6_dir_provedu exprof6_ministro exprof6_own exprof7_na exprof7_dir_esc exprof7_dir_munedu exprof7_dir_provedu exprof7_ministro exprof7_own exprof8_na exprof8_dir_esc exprof8_dir_munedu exprof8_dir_provedu exprof8_ministro exprof8_own exprof9_na exprof9_dir_esc exprof9_dir_munedu exprof9_dir_provedu exprof9_ministro exprof9_own exprof10_na exprof10_dir_esc exprof10_dir_munedu exprof10_dir_provedu exprof10_ministro exprof10_own exprof11_na exprof11_dir_esc exprof11_dir_munedu exprof11_dir_provedu exprof11_ministro exprof11_own exprof12_na exprof12_dir_esc exprof12_dir_munedu exprof12_dir_provedu exprof12_ministro exprof12_own exprof13_na exprof13_dir_esc exprof13_dir_munedu exprof13_dir_provedu exprof13_ministro exprof13_own{
replace `var' = 0 if `var'==.
}

forval n=1/13{
replace exprof`n'_na=. if exproftotal`n'==0
replace exprof`n'_dir_esc=. if exproftotal`n'==0
replace exprof`n'_dir_munedu =. if exproftotal`n'==0
replace exprof`n'_dir_provedu =. if exproftotal`n'==0
replace exprof`n'_ministro =. if exproftotal`n'==0
replace exprof`n'_own=. if exproftotal`n'==0
}

rename exprof(#)_na Q7_15_na_0(#)
rename exprof(#)_dir_esc Q7_15_dir_esc_0(#)
rename exprof(#)_dir_munedu Q7_15_dir_munedu_0(#)
rename exprof(#)_dir_provedu Q7_15_dir_provedu_0(#)
rename exprof(#)_ministro Q7_15_ministro_0(#)
rename exprof(#)_own Q7_15_own_0(#)

rename exprof(##)_na Q7_15_na_(##)
rename exprof(##)_dir_esc Q7_15_dir_sch_(##)
rename exprof(##)_dir_munedu Q7_15_dir_munedu_(##)
rename exprof(##)_dir_provedu Q7_15_dir_provedu_(##)
rename exprof(##)_ministro Q7_15_minister_(##)
rename exprof(##)_own Q7_15_own_(##)

lab var S7_14_15_0_S7_156 "AUX (OTHER)"
lab var S7_14_15_1_S7_156 "AUX (OTHER)"
lab var S7_14_15_2_S7_156 "AUX (OTHER)"
lab var S7_14_15_3_S7_156 "AUX (OTHER)"
lab var S7_14_15_4_S7_156 "AUX (OTHER)"
lab var S7_14_15_5_S7_156 "AUX (OTHER)"
lab var S7_14_15_6_S7_156 "AUX (OTHER)"
lab var S7_14_15_7_S7_156 "AUX (OTHER)"
lab var S7_14_15_8_S7_156 "AUX (OTHER)"
lab var S7_14_15_9_S7_156 "AUX (OTHER)"
lab var S7_14_15_10_S7_156 "AUX (OTHER)"
lab var S7_14_15_11_S7_156 "AUX (OTHER)"
lab var S7_14_15_12_S7_156 "AUX (OTHER)"

lab var S7_14_15_0_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_1_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_2_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_3_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_4_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_5_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_6_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_7_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_8_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_9_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_10_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_11_S7_15_C6 "AUX (OTHER)"
lab var S7_14_15_12_S7_15_C6 "AUX (OTHER)"


drop exproftotal1 exproftotal2 exproftotal3 exproftotal4 exproftotal5 exproftotal6 exproftotal7 exproftotal8 exproftotal9 exproftotal10 exproftotal11 exproftotal12 exproftotal13

order prof1 prof2 prof3 prof4 prof5 prof6 prof7 prof8 prof9 prof10 prof11 prof12 prof13 prof14 prof15 prof16 prof17 prof18 prof19 prof20 prof21 S7_1_12_0_S7_7_C9 S7_1_12_1_S7_7_C9 S7_1_12_2_S7_7_C9 S7_1_12_3_S7_7_C9 S7_1_12_4_S7_7_C9 S7_1_12_5_S7_7_C9 S7_1_12_6_S7_7_C9 S7_1_12_7_S7_7_C9 S7_1_12_8_S7_7_C9 S7_1_12_9_S7_7_C9 S7_1_12_10_S7_7_C9 S7_1_12_11_S7_7_C9 S7_1_12_12_S7_7_C9 S7_1_12_13_S7_7_C9 S7_1_12_14_S7_7_C9 S7_1_12_15_S7_7_C9 S7_1_12_16_S7_7_C9 S7_1_12_17_S7_7_C9 S7_1_12_18_S7_7_C9 S7_1_12_19_S7_7_C9 S7_1_12_20_S7_7_C9 S7_1_12_0_S7_7_C11 S7_1_12_1_S7_7_C11 S7_1_12_2_S7_7_C11 S7_1_12_3_S7_7_C11 S7_1_12_4_S7_7_C11 S7_1_12_5_S7_7_C11 S7_1_12_6_S7_7_C11 S7_1_12_7_S7_7_C11 S7_1_12_8_S7_7_C11 S7_1_12_9_S7_7_C11 S7_1_12_10_S7_7_C11 S7_1_12_11_S7_7_C11 S7_1_12_12_S7_7_C11 S7_1_12_13_S7_7_C11 S7_1_12_14_S7_7_C11 S7_1_12_15_S7_7_C11 S7_1_12_16_S7_7_C11 S7_1_12_17_S7_7_C11 S7_1_12_18_S7_7_C11 S7_1_12_19_S7_7_C11 S7_1_12_20_S7_7_C11 S7_1_12_0_S7_7_C12 S7_1_12_1_S7_7_C12 S7_1_12_2_S7_7_C12 S7_1_12_3_S7_7_C12 S7_1_12_4_S7_7_C12 S7_1_12_5_S7_7_C12 S7_1_12_6_S7_7_C12 S7_1_12_7_S7_7_C12 S7_1_12_8_S7_7_C12 S7_1_12_9_S7_7_C12 S7_1_12_10_S7_7_C12 S7_1_12_11_S7_7_C12 S7_1_12_12_S7_7_C12 S7_1_12_13_S7_7_C12 S7_1_12_14_S7_7_C12 S7_1_12_15_S7_7_C12 S7_1_12_16_S7_7_C12 S7_1_12_17_S7_7_C12 S7_1_12_18_S7_7_C12 S7_1_12_19_S7_7_C12 S7_1_12_20_S7_7_C12 S7_1_12_0_S7_12_C8 S7_1_12_1_S7_12_C8 S7_1_12_2_S7_12_C8 S7_1_12_3_S7_12_C8 S7_1_12_4_S7_12_C8 S7_1_12_5_S7_12_C8 S7_1_12_6_S7_12_C8 S7_1_12_7_S7_12_C8 S7_1_12_8_S7_12_C8 S7_1_12_9_S7_12_C8 S7_1_12_10_S7_12_C8 S7_1_12_11_S7_12_C8 S7_1_12_12_S7_12_C8 S7_1_12_13_S7_12_C8 S7_1_12_14_S7_12_C8 S7_1_12_15_S7_12_C8 S7_1_12_16_S7_12_C8 S7_1_12_17_S7_12_C8 S7_1_12_18_S7_12_C8 S7_1_12_19_S7_12_C8 S7_1_12_20_S7_12_C8 exprof1 exprof2 exprof3 exprof4 exprof5 exprof6 exprof7 exprof8 exprof9 exprof10 exprof11 exprof12 exprof13 S7_14_15_0_S7_14_C9 S7_14_15_1_S7_14_C9 S7_14_15_2_S7_14_C9 S7_14_15_3_S7_14_C9 S7_14_15_4_S7_14_C9 S7_14_15_5_S7_14_C9 S7_14_15_6_S7_14_C9 S7_14_15_7_S7_14_C9 S7_14_15_8_S7_14_C9 S7_14_15_9_S7_14_C9 S7_14_15_10_S7_14_C9 S7_14_15_11_S7_14_C9 S7_14_15_12_S7_14_C9 S7_14_15_0_S7_156 S7_14_15_1_S7_156 S7_14_15_2_S7_156 S7_14_15_3_S7_156 S7_14_15_4_S7_156 S7_14_15_5_S7_156 S7_14_15_6_S7_156 S7_14_15_7_S7_156 S7_14_15_8_S7_156 S7_14_15_9_S7_156 S7_14_15_10_S7_156 S7_14_15_11_S7_156 S7_14_15_12_S7_156 S7_14_15_0_S7_15_C6 S7_14_15_1_S7_15_C6 S7_14_15_2_S7_15_C6 S7_14_15_3_S7_15_C6 S7_14_15_4_S7_15_C6 S7_14_15_5_S7_15_C6 S7_14_15_6_S7_15_C6 S7_14_15_7_S7_15_C6 S7_14_15_8_S7_15_C6 S7_14_15_9_S7_15_C6 S7_14_15_10_S7_15_C6 S7_14_15_11_S7_15_C6 S7_14_15_12_S7_15_C6, after(Q7_15_own_13)
}
********************************************************************************
********************************** SECTION 8 ***********************************
********************************************************************************
{
lab var S8_0 "Number of people in school directory board"
rename S8_0 Q8_01

replace Q8_01 = 5 if S8_00_5_S8_1=="Não existe o sexto elemento. Erro de preenchimento"
replace Q8_01 = 8 if S8_00_8_S8_1=="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

forval n=1/10 {
gen director`n' = 1 if Q8_01>=`n'
}
foreach var in director1 director2 director3 director4 director5 director6 director7 director8 director9 director10{
lab var `var' "AUX"
}

drop S8_00_10_S8_1 S8_00_11_S8_1 S8_00_12_S8_1 S8_00_13_S8_1 S8_00_14_S8_1 S8_00_15_S8_1 S8_00_10_S8_2 S8_00_11_S8_2 S8_00_12_S8_2 S8_00_13_S8_2 S8_00_14_S8_2 S8_00_15_S8_2 S8_00_10_S8_2_C5 S8_00_11_S8_2_C5 S8_00_12_S8_2_C5 S8_00_13_S8_2_C5 S8_00_14_S8_2_C5 S8_00_15_S8_2_C5 S8_00_10_S8_3 S8_00_11_S8_3 S8_00_12_S8_3 S8_00_13_S8_3 S8_00_14_S8_3 S8_00_15_S8_3 S8_00_10_S8_4 S8_00_11_S8_4 S8_00_12_S8_4 S8_00_13_S8_4 S8_00_14_S8_4 S8_00_15_S8_4 S8_00_10_S8_5 S8_00_11_S8_5 S8_00_12_S8_5 S8_00_13_S8_5 S8_00_14_S8_5 S8_00_15_S8_5 S8_00_10_S8_6 S8_00_11_S8_6 S8_00_12_S8_6 S8_00_13_S8_6 S8_00_14_S8_6 S8_00_15_S8_6 S8_00_10_S8_7 S8_00_11_S8_7 S8_00_12_S8_7 S8_00_13_S8_7 S8_00_14_S8_7 S8_00_15_S8_7 S8_00_10_S8_7_C14 S8_00_11_S8_7_C14 S8_00_12_S8_7_C14 S8_00_13_S8_7_C14 S8_00_14_S8_7_C14 S8_00_15_S8_7_C14 S8_00_10_S8_8 S8_00_11_S8_8 S8_00_12_S8_8 S8_00_13_S8_8 S8_00_14_S8_8 S8_00_15_S8_8

replace S8_00_8_S8_1="" if S8_00_8_S8_1=="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

replace S8_00_5_S8_1="" if S8_00_5_S8_1=="Não existe o sexto elemento. Erro de preenchimento"

lab var S8_00_0_S8_1 "(1) Name of the directory board member"
lab var S8_00_1_S8_1 "(2) Name of the directory board member"
lab var S8_00_2_S8_1 "(3) Name of the directory board member"
lab var S8_00_3_S8_1 "(4) Name of the directory board member"
lab var S8_00_4_S8_1 "(5) Name of the directory board member"
lab var S8_00_5_S8_1 "(6) Name of the directory board member"
lab var S8_00_6_S8_1 "(7) Name of the directory board member"
lab var S8_00_7_S8_1 "(8) Name of the directory board member"
lab var S8_00_8_S8_1 "(9) Name of the directory board member"
lab var S8_00_9_S8_1 "(10) Name of the directory board member"

rename S8_00_0_S8_1 Q8_01_01
rename S8_00_1_S8_1 Q8_01_02
rename S8_00_2_S8_1 Q8_01_03
rename S8_00_3_S8_1 Q8_01_04
rename S8_00_4_S8_1 Q8_01_05
rename S8_00_5_S8_1 Q8_01_06
rename S8_00_6_S8_1 Q8_01_07
rename S8_00_7_S8_1 Q8_01_08
rename S8_00_8_S8_1 Q8_01_09
rename S8_00_9_S8_1 Q8_01_10


foreach var in S8_00_0_S8_2 S8_00_1_S8_2 S8_00_2_S8_2 S8_00_3_S8_2 S8_00_4_S8_2 S8_00_5_S8_2 S8_00_6_S8_2 S8_00_7_S8_2 S8_00_8_S8_2 S8_00_9_S8_2{
replace `var' = . if `var'==5
recode `var' (3=7) (4=8)
}

#delimit;
;
lab def Q8_02
1 "Parent/Guardian Committee Representative"
2 "Director of the school"
3 "Deputy director of the school"
4 "Secretary"
5 "Chefe de turno"
6 "Other coordinator"
7 "Teacher"
8 "Community Representative"
;
lab val S8_00_0_S8_2 S8_00_1_S8_2 S8_00_2_S8_2 S8_00_3_S8_2 S8_00_4_S8_2 S8_00_5_S8_2 S8_00_6_S8_2 S8_00_7_S8_2 S8_00_8_S8_2 S8_00_9_S8_2 Q8_02
;
#delimit cr

replace S8_00_1_S8_2 = 3 if S8_00_1_S8_2_C5=="Subdiretor pedagogico"
replace S8_00_1_S8_2 = 3 if S8_00_1_S8_2_C5=="Subdiretor"
replace S8_00_1_S8_2 = 3 if S8_00_1_S8_2_C5=="Subdiretor"
replace S8_00_1_S8_2 = 3 if S8_00_1_S8_2_C5=="sub-director"
replace S8_00_1_S8_2 = 3 if S8_00_1_S8_2_C5=="Sub em exercicio"
replace S8_00_1_S8_2 = 3 if S8_00_1_S8_2_C5=="Sub diretora"
replace S8_00_1_S8_2 = 3 if S8_00_1_S8_2_C5=="SUB DIRECTORA"
replace S8_00_1_S8_2 = 3 if S8_00_1_S8_2_C5=="SUB DIRECT"
replace S8_00_1_S8_2 = 3 if S8_00_1_S8_2_C5=="Sub - Directora"
replace S8_00_1_S8_2 = 5 if S8_00_1_S8_2_C5=="Chefe de turno da manhâ"
replace S8_00_1_S8_2 = 4 if S8_00_1_S8_2_C5=="chefe de secretaria"
replace S8_00_2_S8_2 = 4 if S8_00_2_S8_2_C5=="secretaria"
replace S8_00_2_S8_2 = 4 if S8_00_2_S8_2_C5=="s3cretario"
replace S8_00_2_S8_2 = 5 if S8_00_2_S8_2_C5=="Coordenador de Turno"
replace S8_00_2_S8_2 = 5 if S8_00_2_S8_2_C5=="coordenador de turno"
replace S8_00_2_S8_2 = 6 if S8_00_2_S8_2_C5=="Coordenador de actividades extra corricular"
replace S8_00_2_S8_2 = 5 if S8_00_2_S8_2_C5=="coodenador de turno"
replace S8_00_2_S8_2 = 5 if S8_00_2_S8_2_C5=="Chefe de Turno da Tarde"
replace S8_00_2_S8_2 = 5 if S8_00_2_S8_2_C5=="Chefe de Turno"
replace S8_00_2_S8_2 = 5 if S8_00_2_S8_2_C5=="Chefe de Turno"
replace S8_00_2_S8_2 = 5 if S8_00_2_S8_2_C5=="Chefe de turno"
replace S8_00_2_S8_2 = 4 if S8_00_2_S8_2_C5=="Chefe de secretaria em exercicio"
replace S8_00_2_S8_2 = 4 if S8_00_2_S8_2_C5=="CHEFE DE SECRETARIA"
replace S8_00_2_S8_2 = 4 if S8_00_2_S8_2_C5=="Chefe de secretaria"
replace S8_00_2_S8_2 = 4 if S8_00_2_S8_2_C5=="Chefe de secretaria"
replace S8_00_2_S8_2 = 4 if S8_00_2_S8_2_C5=="Chefe de secretaria"
replace S8_00_2_S8_2 = 4 if S8_00_2_S8_2_C5=="ch secretaria"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="secretaria"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="secretaria"
replace S8_00_3_S8_2 = 6 if S8_00_3_S8_2_C5=="REsponsável pela estatística"
replace S8_00_3_S8_2 = 6 if S8_00_3_S8_2_C5=="OPERARIA DE 2ªCLASSE"
replace S8_00_3_S8_2 = 6 if S8_00_3_S8_2_C5=="Escrituraria"
replace S8_00_3_S8_2 = 6 if S8_00_3_S8_2_C5=="Coordenadora da 7ª classe"
replace S8_00_3_S8_2 = 5 if S8_00_3_S8_2_C5=="Chefe de Turno"
replace S8_00_3_S8_2 = 5 if S8_00_3_S8_2_C5=="Chefe de Turno"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="Chefe de Secretaria"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="Chefe de Secretaria"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="Chefe de secretaria"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="Chefe de secretaria"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="chefe de secretaria"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="Chefe de secretaria"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="ch adj secretaria"
replace S8_00_3_S8_2 = 4 if S8_00_3_S8_2_C5=="Assistente de secretaria"
replace S8_00_3_S8_2 = 6 if S8_00_3_S8_2_C5=="Administrativo"
replace S8_00_4_S8_2 = 4 if S8_00_4_S8_2_C5=="Escrituraria"
replace S8_00_4_S8_2 = 6 if S8_00_4_S8_2_C5=="Coordenadora da 9ª Classe"
replace S8_00_4_S8_2 = 6 if S8_00_4_S8_2_C5=="COORDENADOR ENSINO DECADULTO"
replace S8_00_4_S8_2 = 6 if S8_00_4_S8_2_C5=="Coord. ciclo de interesse"
replace S8_00_4_S8_2 = 4 if S8_00_4_S8_2_C5=="Administrativo"
replace S8_00_4_S8_2 = 6 if S8_00_4_S8_2_C5=="Actividade extra curricular"
replace S8_00_5_S8_2 = 4 if S8_00_5_S8_2_C5=="Administrativo"
replace S8_00_5_S8_2 = 6 if S8_00_5_S8_2_C5=="Coordenadora da 8ª Classe"
replace S8_00_6_S8_2 = 6 if S8_00_6_S8_2_C5=="Coordenador do nucleo sindical"
replace S8_00_7_S8_2 = 5 if S8_00_7_S8_2_C5=="Chefe de Secretaria"

lab var S8_00_0_S8_2 "(1) Type of directory board member"
lab var S8_00_1_S8_2 "(2) Type of directory board member"
lab var S8_00_2_S8_2 "(3) Type of directory board member"
lab var S8_00_3_S8_2 "(4) Type of directory board member"
lab var S8_00_4_S8_2 "(5) Type of directory board member"
lab var S8_00_5_S8_2 "(6) Type of directory board member"
lab var S8_00_6_S8_2 "(7) Type of directory board member"
lab var S8_00_7_S8_2 "(8) Type of directory board member"
lab var S8_00_8_S8_2 "(9) Type of directory board member"
lab var S8_00_9_S8_2 "(10) Type of directory board member"

rename S8_00_0_S8_2 Q8_02_01
rename S8_00_1_S8_2 Q8_02_02
rename S8_00_2_S8_2 Q8_02_03
rename S8_00_3_S8_2 Q8_02_04
rename S8_00_4_S8_2 Q8_02_05
rename S8_00_5_S8_2 Q8_02_06
rename S8_00_6_S8_2 Q8_02_07
rename S8_00_7_S8_2 Q8_02_08
rename S8_00_8_S8_2 Q8_02_09
rename S8_00_9_S8_2 Q8_02_10

forval n=0/9{
lab var S8_00_`n'_S8_2_C5 "AUX (OTHER)"
}

#delimit ;
;
lab def Q8_03
1 "Director"
2 "Deputy Director"
3 "Treasurer"
4 "Secretary"
5 "Member";
lab val S8_00_0_S8_3 S8_00_1_S8_3 S8_00_2_S8_3 S8_00_3_S8_3 S8_00_4_S8_3 S8_00_5_S8_3 S8_00_6_S8_3 S8_00_7_S8_3 S8_00_8_S8_3 S8_00_9_S8_3 Q8_03
;
#delimit cr

lab var S8_00_0_S8_3 "(1) Position in the school directory board"
lab var S8_00_1_S8_3 "(2) Position in the school directory board"
lab var S8_00_2_S8_3 "(3) Position in the school directory board"
lab var S8_00_3_S8_3 "(4) Position in the school directory board"
lab var S8_00_4_S8_3 "(5) Position in the school directory board"
lab var S8_00_5_S8_3 "(6) Position in the school directory board"
lab var S8_00_6_S8_3 "(7) Position in the school directory board"
lab var S8_00_7_S8_3 "(8) Position in the school directory board"
lab var S8_00_8_S8_3 "(9) Position in the school directory board"
lab var S8_00_9_S8_3 "(10) Position in the school directory board"

rename S8_00_0_S8_3 Q8_03_01
rename S8_00_1_S8_3 Q8_03_02
rename S8_00_2_S8_3 Q8_03_03
rename S8_00_3_S8_3 Q8_03_04
rename S8_00_4_S8_3 Q8_03_05
rename S8_00_5_S8_3 Q8_03_06
rename S8_00_6_S8_3 Q8_03_07
rename S8_00_7_S8_3 Q8_03_08
rename S8_00_8_S8_3 Q8_03_09
rename S8_00_9_S8_3 Q8_03_10

replace S8_00_0_S8_4 = 10 if S8_00_0_S8_4==2005

lab var S8_00_0_S8_4 "(1) Years in school directory board"
lab var S8_00_1_S8_4 "(2) Years in school directory board"
lab var S8_00_2_S8_4 "(3) Years in school directory board"
lab var S8_00_3_S8_4 "(4) Years in school directory board"
lab var S8_00_4_S8_4 "(5) Years in school directory board"
lab var S8_00_5_S8_4 "(6) Years in school directory board"
lab var S8_00_6_S8_4 "(7) Years in school directory board"
lab var S8_00_7_S8_4 "(8) Years in school directory board"
lab var S8_00_8_S8_4 "(9) Years in school directory board"
lab var S8_00_9_S8_4 "(10) Years in school directory board"

rename S8_00_0_S8_4 Q8_04_01
rename S8_00_1_S8_4 Q8_04_02
rename S8_00_2_S8_4 Q8_04_03
rename S8_00_3_S8_4 Q8_04_04
rename S8_00_4_S8_4 Q8_04_05
rename S8_00_5_S8_4 Q8_04_06
rename S8_00_6_S8_4 Q8_04_07
rename S8_00_7_S8_4 Q8_04_08
rename S8_00_8_S8_4 Q8_04_09
rename S8_00_9_S8_4 Q8_04_10

lab var S8_00_0_S8_5 "(1) Age of school directory board member"
lab var S8_00_1_S8_5 "(2) Age of school directory board member"
lab var S8_00_2_S8_5 "(3) Age of school directory board member"
lab var S8_00_3_S8_5 "(4) Age of school directory board member"
lab var S8_00_4_S8_5 "(5) Age of school directory board member"
lab var S8_00_5_S8_5 "(6) Age of school directory board member"
lab var S8_00_6_S8_5 "(7) Age of school directory board member"
lab var S8_00_7_S8_5 "(8) Age of school directory board member"
lab var S8_00_8_S8_5 "(9) Age of school directory board member"
lab var S8_00_9_S8_5 "(10) Age of school directory board member"

rename S8_00_0_S8_5 Q8_05_01
rename S8_00_1_S8_5 Q8_05_02
rename S8_00_2_S8_5 Q8_05_03
rename S8_00_3_S8_5 Q8_05_04
rename S8_00_4_S8_5 Q8_05_05
rename S8_00_5_S8_5 Q8_05_06
rename S8_00_6_S8_5 Q8_05_07
rename S8_00_7_S8_5 Q8_05_08
rename S8_00_8_S8_5 Q8_05_09
rename S8_00_9_S8_5 Q8_05_10

forval n=1/9{
replace Q8_05_0`n' = . if Q8_05_0`n'==0
replace Q8_05_0`n' = . if Q8_05_0`n'==99
}
replace Q8_05_10 = . if Q8_05_10==0
replace Q8_05_10 = . if Q8_05_10==99

lab var S8_00_0_S8_6 "(1) Member of school directory board is female"
lab var S8_00_1_S8_6 "(2) Member of school directory board is female"
lab var S8_00_2_S8_6 "(3) Member of school directory board is female"
lab var S8_00_3_S8_6 "(4) Member of school directory board is female"
lab var S8_00_4_S8_6 "(5) Member of school directory board is female"
lab var S8_00_5_S8_6 "(6) Member of school directory board is female"
lab var S8_00_6_S8_6 "(7) Member of school directory board is female"
lab var S8_00_7_S8_6 "(8) Member of school directory board is female"
lab var S8_00_8_S8_6 "(9) Member of school directory board is female"
lab var S8_00_9_S8_6 "(10) Member of school directory board is female"

rename S8_00_0_S8_6 Q8_06_01
rename S8_00_1_S8_6 Q8_06_02
rename S8_00_2_S8_6 Q8_06_03
rename S8_00_3_S8_6 Q8_06_04
rename S8_00_4_S8_6 Q8_06_05
rename S8_00_5_S8_6 Q8_06_06
rename S8_00_6_S8_6 Q8_06_07
rename S8_00_7_S8_6 Q8_06_08
rename S8_00_8_S8_6 Q8_06_09
rename S8_00_9_S8_6 Q8_06_10

forval n=1/9{
recode Q8_06_0`n' (1=0) (2=1)
}
recode Q8_06_10 (1=0) (2=1)

foreach var in S8_00_0_S8_7 S8_00_1_S8_7 S8_00_2_S8_7 S8_00_3_S8_7 S8_00_4_S8_7 S8_00_5_S8_7 S8_00_6_S8_7 S8_00_7_S8_7 S8_00_8_S8_7 S8_00_9_S8_7{
replace `var' = . if `var'==14
recode `var' (15=12)
}

replace S8_00_0_S8_7 = 14 if S8_00_0_S8_7_C14=="Diaconisa"
replace S8_00_0_S8_7 = 12 if S8_00_0_S8_7_C14=="NADA"
replace S8_00_0_S8_7 = 5 if S8_00_0_S8_7_C14=="PECUARIA"
replace S8_00_0_S8_7 = 4 if S8_00_0_S8_7_C14=="Professor"
replace S8_00_0_S8_7 = 15 if S8_00_0_S8_7_C14=="Secretário para esfera pulitica das comunidades"
replace S8_00_0_S8_7 = 14 if S8_00_0_S8_7_C14=="pastor"

replace S8_00_1_S8_7 = 12 if S8_00_1_S8_7_C14=="NADA"

replace S8_00_2_S8_7 = 15 if S8_00_2_S8_7_C14=="Partido MPLA"

#delimit ;
;
lab def ocu
1 "Part-time salaried employment in the private sector"
2 "Part-time salaried employment in the public sector"
3 "Full-time salaried employment in the private sector"
4 "Full-time salaried employment in the public sector"
5 "Self-employment (does not employ other persons)"
6 "Owner of a business (employs other people)"
7 "Peasants (subsistence agriculture)"
8 "Farmer (employs others)"
9 "Retired"
10 "Student (still in school)"
11 "Domestic worker/housekeeper"
12 "Unemployed"
13 "Fisherman"
14 "Religious figure"
15 "Politician"
;
;
lab val S8_00_0_S8_7 S8_00_1_S8_7 S8_00_2_S8_7 S8_00_3_S8_7 S8_00_4_S8_7 S8_00_5_S8_7 S8_00_6_S8_7 S8_00_7_S8_7 S8_00_8_S8_7 S8_00_9_S8_7 ocu
;
#delimit cr

lab var S8_00_0_S8_7 "(1) Additional occupation"
lab var S8_00_1_S8_7 "(2) Additional occupation"
lab var S8_00_2_S8_7 "(3) Additional occupation"
lab var S8_00_3_S8_7 "(4) Additional occupation"
lab var S8_00_4_S8_7 "(5) Additional occupation"
lab var S8_00_5_S8_7 "(6) Additional occupation"
lab var S8_00_6_S8_7 "(7) Additional occupation"
lab var S8_00_7_S8_7 "(8) Additional occupation"
lab var S8_00_8_S8_7 "(9) Additional occupation"
lab var S8_00_9_S8_7 "(10) Additional occupation"

rename S8_00_0_S8_7 Q8_07_01
rename S8_00_1_S8_7 Q8_07_02
rename S8_00_2_S8_7 Q8_07_03
rename S8_00_3_S8_7 Q8_07_04
rename S8_00_4_S8_7 Q8_07_05
rename S8_00_5_S8_7 Q8_07_06
rename S8_00_6_S8_7 Q8_07_07
rename S8_00_7_S8_7 Q8_07_08
rename S8_00_8_S8_7 Q8_07_09
rename S8_00_9_S8_7 Q8_07_10

lab var S8_00_0_S8_7_C14 "AUX (OTHER)"
lab var S8_00_1_S8_7_C14 "AUX (OTHER)"
lab var S8_00_2_S8_7_C14 "AUX (OTHER)"
lab var S8_00_3_S8_7_C14 "AUX (OTHER)"
lab var S8_00_4_S8_7_C14 "AUX (OTHER)"
lab var S8_00_5_S8_7_C14 "AUX (OTHER)"
lab var S8_00_6_S8_7_C14 "AUX (OTHER)"
lab var S8_00_7_S8_7_C14 "AUX (OTHER)"
lab var S8_00_8_S8_7_C14 "AUX (OTHER)"
lab var S8_00_9_S8_7_C14 "AUX (OTHER)"

#delimit ;
;
lab def edu1
1 "None"
2 "First grade"
3 "First level (former elementary school)"
4 "Second level (old high school, 5th and 6th grade)"
5 "Third level (former preparatory school, 7th and 8th grades)"
6 "High school (9th to 12th grade)"
7 "Professional technical education (2-4 years)"
8 "University - Angola"
9 "University - abroad"
10 "Post-graduation - Angola"
11 "Graduate - abroad"
;
lab val S8_00_0_S8_8 S8_00_1_S8_8 S8_00_2_S8_8 S8_00_3_S8_8 S8_00_4_S8_8 S8_00_5_S8_8 S8_00_6_S8_8 S8_00_7_S8_8 S8_00_8_S8_8 S8_00_9_S8_8 edu1
;
#delimit cr

lab var S8_00_0_S8_8 "(1) Highest level of education enjoyed"
lab var S8_00_1_S8_8 "(2) Highest level of education enjoyed"
lab var S8_00_2_S8_8 "(3) Highest level of education enjoyed"
lab var S8_00_3_S8_8 "(4) Highest level of education enjoyed"
lab var S8_00_4_S8_8 "(5) Highest level of education enjoyed"
lab var S8_00_5_S8_8 "(6) Highest level of education enjoyed"
lab var S8_00_6_S8_8 "(7) Highest level of education enjoyed"
lab var S8_00_7_S8_8 "(8) Highest level of education enjoyed"
lab var S8_00_8_S8_8 "(9) Highest level of education enjoyed"
lab var S8_00_9_S8_8 "(10) Highest level of education enjoyed"

rename S8_00_0_S8_8 Q8_08_01
rename S8_00_1_S8_8 Q8_08_02
rename S8_00_2_S8_8 Q8_08_03
rename S8_00_3_S8_8 Q8_08_04
rename S8_00_4_S8_8 Q8_08_05
rename S8_00_5_S8_8 Q8_08_06
rename S8_00_6_S8_8 Q8_08_07
rename S8_00_7_S8_8 Q8_08_08
rename S8_00_8_S8_8 Q8_08_09
rename S8_00_9_S8_8 Q8_08_10

forval i=5/8{
	forval n=1/9{
	replace Q8_0`i'_0`n' = . if director`n'==.
	}
replace Q8_0`i'_10 = . if director10==.
}

*NOTE*
* I did not find the first two question on page 18 of the interview.

lab var S8_10A_C1_S8_11 "Teacher representative: How are the representatives nominated?"
lab var S8_10A_C2_S8_11 "Parent/guardian representatives: How are the representatives nominated?"
lab var S8_10A_C3_S8_11 "Community representatives: How are the representatives nominated?"
lab var S8_10A_C4_S8_11 "Representatives of the provincial directorate of education: How are the representatives nominated?"
lab var S8_10A_C1_S8_11_C10 "AUX"
lab var S8_10A_C2_S8_11_C10 "AUX"
lab var S8_10A_C3_S8_11_C10 "AUX"
lab var S8_10A_C4_S8_11_C10 "AUX"

lab var S8_10A_C1_S8_12 "Teacher representative: How often do the elections or appointments take place?"
lab var S8_10A_C2_S8_12 "Parent/guardian representatives: How often do the elections or appointments take place?"
lab var S8_10A_C3_S8_12 "Community representatives: How often do elections or appointments take place?"
lab var S8_10A_C4_S8_12 "Representatives of the provincial directorate of education: How often do the elections or appointments take place?"
lab var S8_10A_C1_S8_12_C5 "AUX"
lab var S8_10A_C2_S8_12_C5 "AUX"
lab var S8_10A_C3_S8_12_C5 "AUX"
lab var S8_10A_C4_S8_12_C5 "AUX"

lab var S8_10A_C1_S8_13 "Teacher representative: Who can vote in these elections?"
lab var S8_10A_C2_S8_13 "Parent/guardian representatives: Who can vote in these elections?"
lab var S8_10A_C3_S8_13 "Community representatives: Who can vote in these elections?"
lab var S8_10A_C4_S8_13 "Representatives of the provincial directorate of education: Who can vote in these elections?"
lab var S8_10A_C1_S8_13_C8 "AUX"
lab var S8_10A_C2_S8_13_C8 "AUX"
lab var S8_10A_C3_S8_13_C8 "AUX"
lab var S8_10A_C4_S8_13_C8 "AUX"

lab var S8_10A_C1_S8_14 "Teacher representative: When did the most recent election take place?"
lab var S8_10A_C2_S8_14 "Parent/guardian representatives: When did the most recent election occur?"
lab var S8_10A_C3_S8_14 "Community representatives: When did the most recent election occur?"
lab var S8_10A_C4_S8_14 "Representatives of the provincial directorate of education: When did the most recent election take place?"

lab var S8_10A_C1_S8_15 "Teacher representative: How many people voted in the most recent election of ...?"
lab var S8_10A_C2_S8_15 "Parent/guardian representatives: How many people voted in the most recent election of ...?"
lab var S8_10A_C3_S8_15 "Community representatives: How many people voted in the most recent election of ...?"
lab var S8_10A_C4_S8_15 "Representatives of the provincial directorate of education: How many people voted in the most recent election of ...?"

lab var S8_10A_C1_S8_16 "Teacher representative: How many people have applied for the most recent elections of ...?"
lab var S8_10A_C2_S8_16 "Parent/guardian representatives: How many people have applied for the most recent elections of ...?"
lab var S8_10A_C3_S8_16 "Community representatives: How many people have applied for the most recent elections of ...?"
lab var S8_10A_C4_S8_16 "Representatives of the provincial directorate of education: How many people have applied for the most recent elections of ...?"

foreach var in S8_10A_C1_S8_11 S8_10A_C2_S8_11 S8_10A_C3_S8_11 S8_10A_C4_S8_11{
replace `var' = . if inlist(`var',10,11)
}

replace S8_10A_C1_S8_11= 10 if S8_10A_C1_S8_11_C10=="nomeado pela repartição municipal da educação"

replace S8_10A_C2_S8_11= 11 if S8_10A_C2_S8_11_C10=="comunidade"
replace S8_10A_C2_S8_11= 11 if S8_10A_C2_S8_11_C10=="Soba"

replace S8_10A_C3_S8_11= 11 if S8_10A_C3_S8_11_C10=="Soba, conselho do bairro"
replace S8_10A_C3_S8_11= 11 if S8_10A_C3_S8_11_C10=="c0munidade"
replace S8_10A_C3_S8_11= 8 if S8_10A_C3_S8_11_C10=="cooerdenador da comissao de pais e encarregados de educaçao"
replace S8_10A_C3_S8_11= 11 if S8_10A_C3_S8_11_C10=="eleitos pela comunidade"
replace S8_10A_C3_S8_11= 11 if S8_10A_C3_S8_11_C10=="nomeados pela comunidade"
replace S8_10A_C3_S8_11= 10 if S8_10A_C3_S8_11_C10=="regedoria"

replace S8_10A_C4_S8_11= 10 if S8_10A_C4_S8_11_C10=="conselho municipal"
replace S8_10A_C4_S8_11= 2 if S8_10A_C4_S8_11_C10=="diretor da escola"
replace S8_10A_C4_S8_11= 10 if S8_10A_C4_S8_11_C10=="repartiçao municipal"

#delimit ;
;
lab def Q8_11
1 "Elected"
2 "Appointed by the principal of the school"
3 "Appointed by the principal of the school, confirmed by the teachers"
4 "Appointed by the principal of the school, confirmed by the rest of the board"
5 "Appointed by the principal of the school, confirmed by representatives of the parent/guardian commission"
6 "Appointed by the rest of the school board"
7 "Appointed by teachers"
8 "Appointed by the parent/guardian commission"
9 "Appointed by the provincial board of Education"
10 "Appointed by the municipal board of education"
11 "Appointed by the community"
;
lab val S8_10A_C1_S8_11 S8_10A_C2_S8_11 S8_10A_C3_S8_11 S8_10A_C4_S8_11 Q8_11
;
#delimit cr

foreach var in S8_10A_C1_S8_12 S8_10A_C2_S8_12 S8_10A_C3_S8_12 S8_10A_C4_S8_12{
replace `var' = . if inlist(`var',5,6)
recode `var' (3=5) (4=6)
}

replace S8_10A_C1_S8_12 = 4 if S8_10A_C1_S8_12_C5=="conforme odesempenho"
replace S8_10A_C2_S8_13 = 3 if S8_10A_C2_S8_12_C5=="3"
replace S8_10A_C2_S8_13 = 4 if S8_10A_C2_S8_12_C5=="4 anos"

#delimit ;
;
lab def Q8_12
1 "Every year"
2 "Every two years"
3 "Every three years"
4 "Every four years"
5 "Every five years"
6 "Irregularly / when position is open"
;
lab val S8_10A_C1_S8_12 S8_10A_C2_S8_12 S8_10A_C3_S8_12 S8_10A_C4_S8_12 Q8_12
;
#delimit cr

foreach var in S8_10A_C1_S8_13 S8_10A_C2_S8_13 S8_10A_C3_S8_13 S8_10A_C4_S8_13{
replace `var' = . if inlist(`var',6,7,8,9)
}

replace S8_10A_C1_S8_13 = 4 if S8_10A_C1_S8_13_C8=="a dire ao e professores"
replace S8_10A_C1_S8_13 = 3 if S8_10A_C1_S8_13_C8=="direcção da escola"

replace S8_10A_C2_S8_13 = 5 if S8_10A_C2_S8_13_C8=="comunidade"
replace S8_10A_C2_S8_13 = 3 if S8_10A_C2_S8_13_C8=="diretor de escola nomeia"
replace S8_10A_C2_S8_13 = 5 if S8_10A_C2_S8_13_C8=="povo da comunidade"

replace S8_10A_C3_S8_13 = 6 if S8_10A_C3_S8_13_C8=="Regedoria"
replace S8_10A_C3_S8_13 = 5 if S8_10A_C3_S8_13_C8=="comunidade"
replace S8_10A_C3_S8_13 = 3 if S8_10A_C3_S8_13_C8=="diretor de escola nomeia"
replace S8_10A_C3_S8_13 = 5 if S8_10A_C3_S8_13_C8=="povo da comunidade"

replace S8_10A_C4_S8_13 = 3 if S8_10A_C4_S8_13_C8=="diretor de escola nomeia"
replace S8_10A_C4_S8_13 = 5 if S8_10A_C4_S8_13_C8=="municipios"

#delimit ;
;
lab def Q8_13
1 "All parents/guardians"
2 "Representatives of the parent/guardian commission"
3 "Director of the school"
4 "Teachers"
5 "Citizens of the community (who do not have children in this school)"
6 "Regedoria"
;
lab val S8_10A_C1_S8_13 S8_10A_C2_S8_13 S8_10A_C3_S8_13 S8_10A_C4_S8_13 Q8_13
;
#delimit cr

/*
NOTE!! Questions 12-16 were not only asked to schools that have "elections"
at question 11
*/

drop S8_10A_C1_S8_14_Codes S8_10A_C2_S8_14_Codes S8_10A_C3_S8_14_Codes S8_10A_C4_S8_14_Codes S8_10A_C1_S8_15_Codes S8_10A_C2_S8_15_Codes S8_10A_C3_S8_15_Codes S8_10A_C4_S8_15_Codes S8_10A_C1_S8_16_Codes S8_10A_C2_S8_16_Codes S8_10A_C3_S8_16_Codes S8_10A_C4_S8_16_Codes

rename S8_10A_C(#)_S8_11 Q8_11_0(#)
rename S8_10A_C(#)_S8_12 Q8_12_0(#)
rename S8_10A_C(#)_S8_13 Q8_13_0(#)
rename S8_10A_C(#)_S8_14 Q8_14_0(#)
rename S8_10A_C(#)_S8_15 Q8_15_0(#)
rename S8_10A_C(#)_S8_16 Q8_16_0(#)

recode S8_17 (2=0)
rename S8_17 Q8_17
lab val Q8_17 dummy
lab var Q8_17 "The school keeps the minutes of its meetings"

rename S8_18 Q8_18
lab var Q8_18 "The number of meetings the direction held last year"

recode S8_19 (2=0)
rename S8_19 Q8_19
lab val Q8_19 dummy
lab var Q8_19 "The school approved a plan of action at the beginning of this year"

rename S8_20 Q8_20
lab var Q8_20 "Date of last direction meeting"
drop S8_20_Codes

order director1 director2 director3 director4 director5 director6 director7 director8 director9 director10 S8_00_0_S8_2_C5 S8_00_1_S8_2_C5 S8_00_2_S8_2_C5 S8_00_3_S8_2_C5 S8_00_4_S8_2_C5 S8_00_5_S8_2_C5 S8_00_6_S8_2_C5 S8_00_7_S8_2_C5 S8_00_8_S8_2_C5 S8_00_9_S8_2_C5 S8_00_0_S8_7_C14 S8_00_1_S8_7_C14 S8_00_2_S8_7_C14 S8_00_3_S8_7_C14 S8_00_4_S8_7_C14 S8_00_5_S8_7_C14 S8_00_6_S8_7_C14 S8_00_7_S8_7_C14 S8_00_8_S8_7_C14 S8_00_9_S8_7_C14 S8_10A_C1_S8_11_C10 S8_10A_C2_S8_11_C10 S8_10A_C3_S8_11_C10 S8_10A_C4_S8_11_C10 S8_10A_C1_S8_12_C5 S8_10A_C2_S8_12_C5 S8_10A_C3_S8_12_C5 S8_10A_C4_S8_12_C5 S8_10A_C1_S8_13_C8 S8_10A_C2_S8_13_C8 S8_10A_C3_S8_13_C8 S8_10A_C4_S8_13_C8, after(Q8_20)
}
********************************************************************************
********************************** SECTION 9 ***********************************
********************************************************************************
{
lab var S9_1 "Are the parents/guardians at the beginning of the school year to elect the representatives of the committee of parents?"
lab var S9_2 "Does the committee of parents meet throughout the school year?"
lab var S9_3 "Does the committee of parents have minutes of their meetings?"
lab var S9_4 "Does this school have a parent group per class?"
lab var S9_5 "Does the committee of parents have any coordinators?"
lab var S9_6 "What is the name of the coordinator of the committee of parents?"
lab var S9_7 "What is the highest level of education obtained by the coordinator of the committee of parents?"
lab var S9_8 "What is the main occupation of the coordinator of the committee of parents?"
lab var S9_9 "How long has the coordinator of the committee of parents held this position?"

gen Q9_1_dum = 1 if inlist(S9_1,1,2,3)
replace Q9_1_dum=0 if inlist(S9_1,4,5)
rename S9_1 Q9_1
order Q9_1_dum, after(Q9_1)
lab val Q9_1_dum dummy

#delimit ;
;
lab def Q9_1
1 "Yes, in all classes"
2 "Yes, in most classes"
3 "Yes, in some classes"
4 "Rarely"
5 "No"
;
lab val Q9_1 Q9_1
;
#delimit cr

lab var Q9_1_dum "Committee of parents is elected in the beginning of the year by parents"

gen Q9_2_dum = 1 if inlist(S9_2,1,2,3)
replace Q9_2_dum=0 if inlist(S9_2,4,5)
rename S9_2 Q9_2
order Q9_2_dum, after(Q9_2)
lab val Q9_2_dum dummy

#delimit ;
;
lab def Q9_2
1 "Yes, once a year"
2 "Yes, once per quarter"
3 "Yes, once a month"
4 "Yes, but only if there is a problem to solve"
5 "No"
;
lab val Q9_2 Q9_2
;
#delimit cr

lab var Q9_2_dum "Commission of parents meets on structural basis throughout the year"

recode S9_3 (2=0)
recode S9_4 (2=0)
recode S9_5 (2=0)

replace S9_4 = . if S9_4==3

lab val S9_3 S9_4 S9_5 dummy

rename S9_3 Q9_3
rename S9_4 Q9_4
rename S9_5 Q9_5

drop S9_6_Codes

lab val S9_7 edu1

replace S9_8 = . if S9_8==14
replace S9_8 = 5 if S9_8_C14=="CONTA PROPRIA"
replace S9_8 = 14 if S9_8_C14=="Catequista"
replace S9_8 = 14 if S9_8_C14=="Pastor de igreja"
replace S9_8 = 4 if S9_8_C14=="Professor"
replace S9_8 = 15 if S9_8_C14=="SOBA"
replace S9_8 = 3 if S9_8_C14=="Segurança do kip"
replace S9_8 = 9 if S9_8_C14=="antigo combatente"
replace S9_8 = 5 if S9_8_C14=="carpinteiro"
replace S9_8 = 3 if S9_8_C14=="fiscal"
replace S9_8 = 5 if S9_8_C14=="mecnico"
replace S9_8 = 14 if S9_8_C14=="pastor"
replace S9_8 = 3 if S9_8_C14=="segurança privado"
replace S9_8 = 5 if S9_8_C14=="serrelheiro"

lab val S9_8 ocu

rename S9_6 Q9_6
rename S9_7 Q9_7
rename S9_8 Q9_8
rename S9_9 Q9_9

replace Q9_6="" if Q9_6=="nao conhece o nome"

lab var S9_8_C14 "AUX"
order S9_8_C14, after(Q9_9)
}
********************************************************************************
********************************** SECTION 10 **********************************
********************************************************************************
{
lab var S10_11 "School director is consulted about the school's annual plan"
lab var S10_12 "School board (entire) is consulted about the school's annual plan"
lab var S10_13 "Teachers are consulted about the school's annual plan"
lab var S10_14 "Representatives of the committee of parents are consulted about the school's annual plan"
lab var S10_15 "Representatives of the provincial directorate of education are consulted about the school's annual plan"
lab var S10_16 "Other stakeholders are consulted about the school's annual plan"
lab var S10_1_C6 "Other stakeholders specified"
lab var S10_2 "How often does the school review your annual plan?"
lab var S10_3 "Does the school have a bank account?"
lab var S10_4 "Does the school have an annual budget?"
lab var S10_51 "School director is consulted about the school's annual budget"
lab var S10_52 "School board (entire) is consulted about the school's annual budget"
lab var S10_53 "Teachers are consulted about the school's annual budget"
lab var S10_54 "Representatives of the committee of parents are consulted about the school's annual budget"
lab var S10_55 "Representatives of the provincial directorate of education are consulted about the school's annual budget"
lab var S10_6 "How often does the school review its annual budget?"
lab var S10_7 "Who has the latest decision about the school's annual budget?"

foreach var in S10_11 S10_12 S10_13 S10_14 S10_15 S10_16{
replace `var' = . if S10_17==1
lab val `var' dummy
}

drop S10_17

replace S10_2 = . if S10_2==5
recode S10_2 (1=2) (2=3) (3=4) (4=5)

replace S10_2 = 2 if S10_2_C5=="3 vezes por ano"
replace S10_2 = 1 if S10_2_C5=="MENSALMENTE"
replace S10_2 = 1 if S10_2_C5=="Mensalmente"
replace S10_2 = 1 if S10_2_C5=="mensal"
replace S10_2 = 1 if S10_2_C5=="mensalmente"
replace S10_2 = 1 if S10_2_C5=="uma vez por mês"

#delimit ;
;
lab def S10_2
1 "Monthly"
2 "At the beginning of each trimester"
3 "Twice a year"
4 "Once a year"
5 "Never"
;
lab val S10_2 S10_2
;
#delimit cr

drop S10_2_C5

rename S10_11 Q10_01_01
rename S10_12 Q10_01_02
rename S10_13 Q10_01_03
rename S10_14 Q10_01_04
rename S10_15 Q10_01_05
rename S10_16 Q10_01_06
rename S10_1_C6 Q10_01_06_o
rename S10_2 Q10_02

recode S10_3 (2=0)
recode S10_4 (2=0)
lab val S10_3 S10_4 dummy
rename S10_3 Q10_03
rename S10_4 Q10_04

foreach var in S10_51 S10_52 S10_53 S10_54 S10_55 S10_56 S10_57 {
replace `var' = . if Q10_04!=1
lab val `var' dummy
}

rename S10_51 Q10_05_01
rename S10_52 Q10_05_02
rename S10_53 Q10_05_03
rename S10_54 Q10_05_04
rename S10_55 Q10_05_05

* NOTE S10_6 and S10_7: NO useful info

drop S10_5_C6 S10_6_C5 S10_7_C4 S10_56 S10_57 S10_6 S10_7
}
********************************************************************************
********************************** SECTION 11 **********************************
********************************************************************************
{
lab var S11_1 "Can you (or the school director) show an approved budget for the 2014 school year?"
lab var S11_2 "Can you (or the school director) show an approved budget for the previous school year (2013)?"
lab var S11_3 "Can you show receipts of expenses for the previous school year (2013)? <B> These include the purchase of tables, chairs, books, , School supplies and other materials </ b> </ br>"
lab var S11_4 "Has the school director consulted the school board before purchasing something specific for the school during this school year?"
lab var S11_5 "Does the school director require the joint signature of school board members to purchase anything specific to the school during this school year?"

lab var S11_6_7_C1_S11_6 "A. Teaching (includes teaching materials that parents bought): 6. What were the expected expenses in the previous school year (2013)? <I>: please refer to the budget line, if possible. If there were no expected expenses, enter 0. </ I>"
lab var S11_6_7_C2_S11_6 "C. Management: 6. What were the expected expenses in the previous school year (2013)? <I>: please refer to the budget line, if possible. If there were no expected expenses, enter 0. </ I>"
lab var S11_6_7_C3_S11_6 "D. Administrative: 6. What were the expected expenses in the previous school year (2013)? <I>: please refer to the budget line, if possible. If there were no expected expenses, enter 0. </ I>"
lab var S11_6_7_C4_S11_6 "E. Contingency: 6. What were the expected expenses in the previous school year (2013)? <I>: please refer to the budget line, if possible. If there were no expected expenses, enter 0. </ I>"
lab var S11_6_7_C1_S11_7 "A. Teaching (includes teaching materials that parents bought): 7. What were the actual expenses in the previous school year (2013)? <I> refer to the accounts heading, if possible. If there were no actual expenses, enter 0 </ i>"
lab var S11_6_7_C2_S11_7 "C. Management: 7. What were the actual expenses in the previous school year (2013)? <I> refer to the accounts heading, if possible. If there were no actual expenses, enter 0 </ i>"
lab var S11_6_7_C3_S11_7 "D. Administrative: 7. What were the actual expenses in the previous school year (2013)? <I> refer to the accounts heading, if possible. If there were no actual expenses, enter 0 </ i>"
lab var S11_6_7_C4_S11_7 "E. Contingency: 7. What were the actual expenses in the previous school year (2013)? <I> refer to the accounts heading, if possible. If there were no actual expenses, enter 0 </ i>"
lab var S11_8_9_C1_S11_8 "C. Ministry of Education: [8] What were the expected revenues in the previous school year (2013)?"
lab var S11_8_9_C2_S11_8 "D. Provincial Education Directorate: [8] What were the expected revenues in the previous school year (2013)?"
lab var S11_8_9_C3_S11_8 "E. Provincial Government: [8] What were the expected revenues in the previous school year (2013)?"
lab var S11_8_9_C4_S11_8 "F. Parent contributions: [8] What were the expected income in the previous school year (2013)?"
lab var S11_8_9_C5_S11_8 "G. Local civil society contributions: [8] What were the expected revenues in the previous school year (2013)?"
lab var S11_8_9_C6_S11_8 "H. NGO contributions: [8] What were the expected revenues in the previous school year (2013)?"
lab var S11_8_9_C1_S11_9 "C. Ministry of Education: What were the actual revenues in the previous school year (2013)?"
lab var S11_8_9_C2_S11_9 "D. Provincial Education Directorate: What were the actual revenues in the previous school year (2013)?"
lab var S11_8_9_C3_S11_9 "E. Provincial Government: What were the actual revenues in the previous school year (2013)?"
lab var S11_8_9_C4_S11_9 "F. Parent Contributions: What were the actual earnings in the previous school year (2013)?"
lab var S11_8_9_C5_S11_9 "G. Local civil society contributions: What were the actual revenues in the previous school year (2013)?"
lab var S11_8_9_C6_S11_9 "H. NGO contributions: What were the actual revenues in the previous school year (2013)?"
#delimit ;
;
lab def S11_1_2
1 "Yes"
2 "No, the school does not have this budget"
3 "No, the school has this budget but can not make it available without a formal request"
;
lab val S11_1 S11_2 S11_1_2
;
#delimit cr

rename S11_1 Q11_01
rename S11_2 Q11_02


recode S11_3 (2=0)
replace S11_3 = . if S11_3==3
lab val S11_3 dummy
rename S11_3 Q11_03

replace S11_4 = . if S11_4==5
#delimit ;
;
lab def S11_4
1 "Always"
2 "Sometimes"
3 "Rarely"
4 "Never"
;
lab val S11_4 S11_4
;
#delimit cr
rename S11_4 Q11_04

recode S11_5 (2=0)
replace S11_5 = . if S11_5==3
lab val S11_5 dummy
rename S11_5 Q11_05


*NOTE very little information until the end
* Only deleted the really useless stuff to clean it. No treatment to remaining data

drop S11_6_7_C1_S11_6_Codes S11_6_7_C2_S11_6_Codes S11_6_7_C3_S11_6_Codes S11_6_7_C4_S11_6_Codes S11_6_7_C1_S11_7_Codes S11_6_7_C2_S11_7_Codes S11_6_7_C3_S11_7_Codes S11_6_7_C4_S11_7_Codes S11_8_9_C1_S11_8_Codes S11_8_9_C2_S11_8_Codes S11_8_9_C3_S11_8_Codes S11_8_9_C4_S11_8_Codes S11_8_9_C5_S11_8_Codes S11_8_9_C6_S11_8_Codes S11_8_9_C1_S11_9_Codes S11_8_9_C2_S11_9_Codes S11_8_9_C3_S11_9_Codes S11_8_9_C4_S11_9_Codes S11_8_9_C5_S11_9_Codes S11_8_9_C6_S11_9_Codes
drop S11_6_7_0 S11_6_7_1_C1_Q0 S11_6_7_1_C1_Q1 S11_6_7_1_C1_Q2 S11_8_9_0 S11_8_9_1_C1_Q0 S11_8_9_1_C1_Q1 S11_8_9_1_C1_Q2
}

order school_id

rename S* SP*
rename Q* SQ*

rename resp_id 			S_resp_id
rename bairro_name 		S_bairro_name
rename school_name  	S_school_name
rename resp_name  		S_resp_name
rename resp_tel  		S_resp_tel
rename vil_id  			S_vil_id
rename commune_name  	S_commune_name
rename school_tel 		S_school_tel
rename resp_position 	S_resp_position
rename resp_total 		S_resp_total
rename resp_directores 	S_resp_directores
rename resp_vice 		S_resp_vice
rename resp_profdisp 	S_resp_profdisp
rename resp_profturma 	S_resp_profturma
rename resp_profother 	S_resp_profother
rename resp_respdiredu 	S_resp_respdiredu
rename resp_secretary 	S_resp_secretary
rename resp_chefbairro 	S_resp_chefbairro
rename resp_commpais 	S_resp_commpais
rename typecomm 		S_typecomm

save "$Baseline_dtRaw/_intermediate files/baseline_school.dta", replace
